home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / THINK C Digest / 1991 / 91-04 < prev    next >
Text File  |  1995-12-31  |  96KB  |  2,630 lines

  1. 
  2. Path: ucivax!gateway
  3. From: jp48+@andrew.cmu.edu (Jonathan Pace)
  4. Subject: How do I do this conversion.
  5. Message-ID: <wbxfr8a00WB3E9u0Y6@andrew.cmu.edu>
  6. Newsgroups: fa.think-c
  7. Lines: 64
  8. Date: 1 Apr 91 04:59:08 GMT
  9.  
  10. I have the following code working correctly on a spark station in Unix.  I want
  11. to run it on my Mac IIcx in Think-C so I can get out of my profs office and do
  12. the work for him at my house.  Can someone please tell me what's wrong.
  13.  
  14.   fp = fopen("DATA","r");
  15.   fscanf(fp,"%d %d %d ",&(in->num_feeder),&(in->num_place),&(in->preamble));
  16.   printf("# feeders = %d, # placements = %d, preamble = %d.\n",in->num_feeder,
  17.           in->num_place,in->preamble);
  18.  
  19. /** this part is working.  the values printed out are correct **/
  20.  
  21.   in->x = (int *) malloc(sizeof(int)*(in->num_place+1));
  22.   in->y = (int *) malloc(sizeof(int)*(in->num_place+1));
  23.   in->feeder = (int *) malloc(sizeof(int)*(in->num_place+1));
  24.   in->rotation = (int *) malloc(sizeof(int)*(in->num_place+1));
  25.   in->board = (int *) malloc(sizeof(int)*(in->num_place+1));
  26.   in->id = (int *) malloc(sizeof(int)*(in->num_place+1));
  27.   in->speed = (double *) malloc(sizeof(double)*(in->num_feeder+1));
  28.   bin->x = (int *) malloc(sizeof(int)*(in->num_place+1));
  29.   bin->y = (int *) malloc(sizeof(int)*(in->num_place+1));
  30.   bin->feeder = (int *) malloc(sizeof(int)*(in->num_place+1));
  31.   bin->rotation = (int *) malloc(sizeof(int)*(in->num_place+1));
  32.   bin->board = (int *) malloc(sizeof(int)*(in->num_place+1));
  33.   bin->id = (int *) malloc(sizeof(int)*(in->num_place+1));
  34.   bin->speed = (double *) malloc(sizeof(double)*(in->num_feeder+1));
  35.   bin->rotate = (double *) malloc(sizeof(double)*(in->num_place+1));
  36.  
  37.   for (node=0;node<in->num_place;node++) {
  38.     fscanf(fp,"%d %d %d %d %d %d ",&(in->id[node]),&(in->board[node]),
  39.        &(in->feeder[node]),&(in->x[node]),&(in->y[node]),
  40.        &(in->rotation[node]));
  41.     printf("node # = %d, id # = %d, board # = %d, feeder # = %d, x = %d, y = %d, rotation = %d.\n",
  42.             node,in->id[node],in->board[node],in->feeder[node],
  43.             in->x[node],in->y[node],in->rotation[node]);
  44.   }
  45. /**  this is where the problem is.  the values printed here are wrong, and my
  46. Mac hangs up with the message "bomb" in the debugger  **/
  47.  
  48. the data file looks like this
  49.  
  50. 142 17 2
  51. 0 1 0 -32768 3429 0
  52. 1 1 0 -5638 5638 0
  53. 2 1 92 -12616 12044 270
  54. 3 1 95 -11811 11760 180
  55. 4 1 7 -11485 10711 270
  56. 5 1 7 -12031 10685 270
  57. 6 1 90 -12661 11201 180
  58. 7 1 2 -12031 9850 90
  59. 8 1 7 -12819 10558 270
  60. 9 1 24 -11963 9042 180
  61. 10 1 14 -12407 8813 180
  62. 11 1 7 -12730 9837 90
  63. 12 1 2 -12489 9837 90
  64. 13 1 7 -10538 6146 180
  65. 14 1 13 -10276 5481 90
  66. 15 1 23 -10518 5481 90
  67. 16 1 103 -10462 5181 180
  68. I just started programming C on the Mac, and I don't have that much under Unix.
  69. Can someone please tell me what seems to be wrong.
  70.  
  71. Thanks,
  72.  
  73. Jon Pace
  74. 
  75. 
  76. Path: ucivax!gateway
  77. From: nick@lfcs.edinburgh.ac.UK (Nick Rothwell)
  78. Subject: Re: How do I do this conversion.
  79. Message-ID: <1130.9104011219@lfcs.ed.ac.uk>
  80. Newsgroups: fa.think-c
  81. Lines: 15
  82. Date: 1 Apr 91 12:20:23 GMT
  83.  
  84. >the data file looks like this
  85. >
  86. >142 17 2
  87. >0 1 0 -32768 3429 0
  88. >...
  89.  
  90. Well, I could be mistaken, but... While -32768 is a valid 16-bit signed
  91. integer (MININT in effect), if the THINK C I/O library reads its negative
  92. integers by reading them as positive integers and then negating them, it'll
  93. get this wrong.
  94.  
  95. Do I get a gold star or a wooden spoon?
  96.  
  97.         Nick.
  98.  
  99. 
  100. 
  101. Path: ucivax!gateway
  102. From: jbr@cblph.att.COM
  103. Subject: Problem With A TCL Dialog Class
  104. Message-ID: <9104010823.aa16301@ICS.UCI.EDU>
  105. Newsgroups: fa.think-c
  106. Original-From: cblph!jbr (Joseph A. Brownlee)
  107. Lines: 49
  108. Date: 1 Apr 91 16:28:00 GMT
  109.  
  110. I've been rolling my own "dialog boxes" as I needed them and I decided to try
  111. to start working on a class that would generalize the dialogs so that I could
  112. easily define a dialog-like window without creating a new class for every new
  113. dialog.  So, I took a piece of working TCL code I had written to do a single,
  114. hard-coded dialog and began to generalize it, but I haven't had much success
  115. getting it to work.
  116.  
  117. The CDialog class is a sub-class of CWindow.  I create a CPane to hang the
  118. dialog item objects on.  I have methods to add buttons, static text, scroll
  119. bars, etc. to the dialog window.  All calls check for memory allocation/object
  120. creation errors.  The dialog window is created OK, and I can use the controls
  121. in it and they work as expected.   The CStaticText objects are plotted
  122. correctly.  However, when the user clicks the OK or Cancel button, and the
  123. Supervisor invokes the CDialog::Dispose() method, my Mac freezes when it hits
  124. the Dispose() method call on the CPane object (or if I'm lucky, the debugger
  125. catches an odd address error).
  126.  
  127. Using the debugger, what I find is that any method call in the Dispose() method
  128. to the CPane created within the window will croak (for example, I tried calling
  129. SetWantsClicks() instead of Dispose()), so it is not the Dispose method itself
  130. that is failing.  If I press the "In" button, it crashes immediately -- I do
  131. not make it into the method at all, and the source code display does not change.
  132. However, when the Pane is created and when the controls in that Pane are active,
  133. everything is fine.  When I enter the Dispose() method, the Pane is already
  134. trashed and any call which references it will crash.  The handle of the Pane
  135. object hasn't changed, and I even tried adding checks to be sure it wasn't moved
  136. around in memory behind my back and it wasn't.  The data shown for the CPane
  137. object in the Data window all looks to be correct and the debugger has no
  138. trouble displaying it.  I should also mention that the application I am using
  139. to test the class is a clone of the Pededstal application, and I am not doing
  140. anything special between creating the dialog and its Supervisor (a document)
  141. calling its Dispose() method upon receiving the OK or Cancel "click command".
  142.  
  143. I've stepped through this code more times than I care to count, and I can't see
  144. the problem.  Either it's something really obvious that I've missed, or I have
  145. a basic misunderstanding of the TCL classes I'm using (CWindow, CPane, CView,
  146. CControl, et al).  What I'd like is any advice or suggestions from the list
  147. before I (possibly) waste bandwidth posting the actual class source.
  148.  
  149. In case this matters, I'm using THINK C 4.02 on an 8 MB IIcx under System
  150. 6.0.3.
  151.  
  152. Thanks in advance for any help.  The subscribers to this list have been very
  153. helpful to me in the past.
  154.  
  155.    -      _   Joe Brownlee, Analysts International Corporation @ AT&T Bell Labs
  156.   /_\  @ / `  471 E Broad St, Suite 1610, Columbus, Ohio 43215   (614) 860-7461
  157.  /   \ | \_,  E-mail: jbr@cblph.att.com     Who pays attention to what _I_ say?
  158.  "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
  159. 
  160. 
  161. Path: ucivax!gateway
  162. From: tl17+@andrew.cmu.edu (Ta-Chun Lin)
  163. Subject: Close AppleTalk
  164. Message-ID: <cbxrVb600WB3MDm4c3@andrew.cmu.edu>
  165. Newsgroups: fa.think-c
  166. Lines: 8
  167. Date: 1 Apr 91 18:19:28 GMT
  168.  
  169. Hi Everybody:
  170.   Dose anyone know which Toolbox Routine Call can close AppleTalk? I used
  171. "MMPClose"
  172. and "ATPUnload" to close and unload AppleTalk, but AppleTalk did not be closed.
  173. Any
  174. suggestion will be appreciated. Thanks in advance.
  175.  
  176. Shiem-Min Chen
  177. 
  178. 
  179. Path: ucivax!gateway
  180. From: ehorvath@attmail.COM
  181. Subject: Re: How do I do this conversion.
  182. Original-From: attmail!ehorvath (Ned Horvath )
  183. Lines: 18
  184. Date: 1 Apr 91 22:33:39 GMT
  185. Phone: +1 908 671 7100
  186. Message-ID: <9104011431.aa00541@ICS.UCI.EDU>
  187. In-Reply-To: your message <internet0910529360> of Mon Apr  1 04:59:08 GMT 1991
  188. >To: internet!ics.uci.edu!think-c
  189. Content-Type: text
  190. Content-Length: 702
  191. Newsgroups: fa.think-c
  192. Message-Version: 2
  193. EMail-Version: 2
  194. UA-Message-ID: <MAC-1.3.4A1-618034-ehorvath-339>
  195. UA-Content-ID: <MAC-1.3.4A1-618034-ehorvath-339>
  196. MTS-Message-ID: <ehorvath0912224470>
  197.  
  198. >...Can someone please tell me what's wrong.
  199. ...
  200. >  in->x = (int *) malloc(sizeof(int)*(in->num_place+1));
  201.     [many similar statements]
  202. >...my Mac hangs up with the message "bomb" in the debugger...
  203.  
  204. Put "#include <stdlib.h>" at the top of your file.  For reasons known only to
  205. Finagle, in ANSI C 'sizeof' is replaced by an int constant, but malloc
  206. requires a size_t.  In Think C 4.0, the latter is unsigned long.
  207.  
  208. I've replied to the list because this is one of those FAQs that bites
  209. everybody who tries to use malloc with ThC.
  210.  
  211. A better bit of generic advice is to turn on the Require Prototypes option,
  212. which will remind you to include stdlib.h when you forget.
  213.  
  214. =Ned Horvath=
  215. ehorvath@attmail.com
  216. 
  217. 
  218. Path: ucivax!gateway
  219. From: nick@lfcs.edinburgh.ac.UK (Nick Rothwell)
  220. Subject: Re: How do I do this conversion.
  221. Message-ID: <5927.9104020927@lfcs.ed.ac.uk>
  222. Newsgroups: fa.think-c
  223. Lines: 11
  224. Date: 2 Apr 91 09:32:11 GMT
  225.  
  226. >Yes, THINK C reads negative integers the way you describe.  But +32768 =
  227. >-32768, and -(-32768) = -32768, so that shouldn't make any difference,
  228. right?
  229. >(or does it trap overflow?)
  230.  
  231. -32768 is a valid 16-bit integer. +32768 isn't. I don't know how the
  232. library will deal with overflows (or what will happen if it doesn't,
  233. regarding sign extension and so on).
  234.  
  235.         Nick.
  236.  
  237. 
  238. 
  239. Path: ucivax!gateway
  240. From: nick@lfcs.edinburgh.ac.UK (Nick Rothwell)
  241. Subject: Re: Problem With A TCL Dialog Class
  242. Message-ID: <5927.9104020928@lfcs.ed.ac.uk>
  243. Newsgroups: fa.think-c
  244. Lines: 15
  245. Date: 2 Apr 91 09:33:42 GMT
  246.  
  247. The wonderful world of THINK C garbage collection. I can't help you in your
  248. specific problem, but I had lots of hassles of a similar nature. You have
  249. to be careful with Dispose() methods - it's all too easy to end up calling
  250. a method in an object which has already been disposed (e.g. by an inherited
  251. Dispose() method). I seem to remember that objects in the visual heirarchy
  252. close themselves down in such a way that update events can appear as a
  253. result of Dispose() calls, for example. Tracing calls to disposed objects
  254. (and hence into hyperspace) is tricky - it's better to try and understand
  255. exactly what gets disposed of in what order.
  256.  
  257. It's a hassle. This may help you in thinking through your problem, I don't
  258. know.
  259.  
  260.         Nick.
  261.  
  262. 
  263. 
  264. Path: ucivax!gateway
  265. From: Mark.Alldritt@vancouver.osiware.bc.ca (Mark Alldritt)
  266. Subject: Problem with ListMgr
  267. Message-ID: <910402918*Mark.Alldritt@Vancouver.osiware.bc.ca>
  268. Newsgroups: fa.think-c
  269. Lines: 17
  270. Date: 2 Apr 91 18:33:37 GMT
  271.  
  272. Hi,
  273.  
  274. I have been working on a class which displayes lists using the ToolBox ListMgr.
  275. I have everything working very well, but with one exception.
  276.  
  277. When I try to create a list with a vertical scroll bar and a resize box (like
  278. the lists that appear in the ResEdit pickers), the ListMgr does not leave room
  279. for me to draw the resize box (the scroll bar runs the entire height of the
  280. list).  I feel that I have specified the parameters to the LCreate call
  281. correctly.  I've been over and over the section in InsideMac and searched
  282. through the Tech Notes looking for clues.  Can anyone help?  Is there some
  283. bit of Mac magic that I need to know?
  284.  
  285. Thanks in advance,
  286.  
  287. -Mark
  288. alldritt@vancouver.osiware.bc.ca
  289. 
  290. 
  291. Path: ucivax!gateway
  292. From: kenk@sunhd.tellabs.COM (Ken Konecki)
  293. Subject: FPU bomb with LC
  294. Message-ID: <9104021342.AA12758@sunHd.TELLABS.COM>
  295. X-Mailer: ELM [version 2.3 PL11]
  296. Newsgroups: fa.think-c
  297. Lines: 16
  298. Date: 2 Apr 91 20:33:07 GMT
  299.  
  300. My brother-in-law is trying to do some basic C programming (i.e.
  301. no toolbox calls, just the ANSI library) on his LC and it keeps
  302. bombing when he tries to do floating point arithmetic. I don't
  303. have the exact text from the bomb dialog, but the summary is
  304. that the code is expecting an FPU, but of course there isn't one
  305. in the LC. The obvious answer is that the options were set to
  306. generate 68881 calls, but that option was not set.
  307.  
  308. Any less obvious answers?
  309.  
  310. Thanks,
  311.     -Ken K
  312. --
  313. Ken Konecki
  314. "You call some place paradise, kiss it goodbye."
  315. e-mail:kenk@tellabs.com    -or-    ...!uunet!tellab5!kenk
  316. 
  317. 
  318. Path: ucivax!gateway
  319. From: mkelly@cs.uoregon.edu
  320. Subject: VDSettings struct in Video.h - where is it documented?
  321. Message-ID: <9104010831.AA10249@obelix.cs.uoregon.edu>
  322. Newsgroups: fa.think-c
  323. Lines: 20
  324. Date: 2 Apr 91 22:24:03 GMT
  325.  
  326.  
  327.  
  328. I can't find any mention of the VDSettings type anywhere but in Video.h where
  329. it's defined.  I'd like to be able to use it to control the settings within
  330. (csBrightVal, for example), but I can't even figure out which routine to send
  331. it to.  Do I send it to PBControl, and if so, what would the csCode be?  Do I
  332. use the slot manager, and if so, how?  I have already read 'Designing Cards
  333. and Drivers', and 'Guide to the Macintosh Family Hardware' and of course IM.
  334.  
  335. _Any_ help would be much appreciated.
  336.  
  337. Thanks in advance,
  338.  
  339. Mike.
  340. _____________________________________________________________________________
  341. Michael A. Kelly                                   America Online: Michael792
  342. mkelly@cs.uoregon.edu                                  Compu$erve: 73567,1651
  343. _____________________________________________________________________________
  344. "The whole world is about three drinks behind."
  345.         - Humphrey Bogart
  346. 
  347. 
  348. Path: ucivax!gateway
  349. From: cl29+@andrew.cmu.EDU (Cameron Christopher Long)
  350. Subject: Random compile bugs
  351. Message-ID: <sbyVkbS00WAw02Q1sG@andrew.cmu.edu>
  352. Newsgroups: fa.think-c
  353. Lines: 27
  354. Date: 3 Apr 91 18:21:12 GMT
  355.  
  356. Hey all...
  357.  
  358. Here's an interesting situation that I hope you can help me resolve:
  359.  
  360. We have a fairly good sized application going, and when we compile, we
  361. occasionally get bad code. I have verified that none of the segments is
  362. over 30K, but apparently some of the segments aren't being loaded during
  363. execution, since we are getting bus errors and the like which indicate
  364. that the code being called isn't there...
  365.  
  366. When compiling, we have about a 30% chance of getting good code, and the
  367. other 70% of the time, certain functions don't work, or the program will
  368. just crash in the middle of execution.
  369.  
  370. I realize that this is a rather vague description of our problem, but I
  371. am hoping that someone will say "AH... I know what they are doing wrong!"
  372.  
  373. If you have any suggestions, comments, or see the obvious problem, please
  374. send mail to:
  375.  
  376. cl29@andrew.cmu.edu
  377.  
  378.  
  379. Thanks for your time,
  380. Cameron Long
  381.  
  382. PS. THINK C v4.0.4
  383. 
  384. 
  385. Path: ucivax!gateway
  386. From: nagel@buckaroo.ICS.UCI.EDU (Mark Nagel)
  387. Subject: ADMIN: About this list...
  388. Message-ID: <21068.670732776@buckaroo.ics.uci.edu>
  389. Newsgroups: fa.think-c
  390. Reply-To: nagel@ICS.UCI.EDU
  391. Organization: University of California, Irvine - Dept of ICS
  392. Lines: 76
  393. Date: 4 Apr 91 02:40:32 GMT
  394. Phone: (714) 856-5039
  395.  
  396. [Monthly posting]
  397.  
  398.         About... The Think C electronic mailing list
  399.         --------------------------------------------
  400.  
  401. This list has been created to discuss topics of interest among users of
  402. Symantec's Think C compiler for the Macintosh personal computer.  These
  403. topics include:
  404.  
  405.     o programming tips and examples
  406.  
  407.     o discussion of compiler bugs and/or misfeatures and workarounds
  408.  
  409.     o questions related to programming the Macintosh with Think C and/or
  410.       object-oriented programming
  411.  
  412. One request: if someone submits a question on something that seems simple to
  413. you, please remember that it will seem simple to many of the other 300+
  414. subscribers to the list.  Please reply to the sender directly unless you
  415. feel it is warranted to broadcast the reply.  The person who submitted the
  416. question is urged to followup at some time in the future with a summary of
  417. responses, so others who might be interested can see what the solution was.
  418. This simple rule will prevent much of the chaff that is present on many
  419. mailing lists and newsgroups.
  420.  
  421. Archives of past discussions on the list are stored in the Think C Archive
  422. (see below for access information) in the directory /mac/think-c/archives.
  423.  
  424. Requests for addition/deletion/address/questions changes should be sent to:
  425.  
  426.     think-c-request@ics.uci.edu
  427.  
  428. Submissions to the list should be sent to:
  429.  
  430.     think-c@ics.uci.edu
  431.  
  432.             About... The Think C Archive
  433.             ----------------------------
  434.  
  435. An archive of submitted source code and other packages related to Think C is
  436. available from ics.uci.edu via two transfer methods:
  437.  
  438.     o anonymous ftp to ics.uci.edu (128.195.1.1)
  439.  
  440.     o automated e-mail archive server on ics.uci.edu
  441.  
  442. The archive is stored in /mac/think-c for ftp.  To use the archive server,
  443. send mail to:
  444.  
  445.     archive-server@ics.uci.edu
  446.  
  447. Extensive help is available for this server by using a subject consisting of
  448. the word "help."  For there, you should be able to determine how to navigate
  449. the archive.
  450.  
  451. Submissions to the archive may be accomplished in one of two ways:
  452.  
  453.     o use anonymous ftp to drop the submission in /incoming on
  454.       ics.uci.edu and send a note to think-c-request summarizing the
  455.       submission.
  456.  
  457.     o use electronic mail to send the submission to think-c-request.
  458.  
  459. After the submission has been moved to the proper directory in the archive,
  460. a notice will be sent to the list describing the new addition(s) to the
  461. archive.  These notices will always have subject headers of the form
  462. 'ARCHIVE: xxx', where xxx is a brief description of the new addition.
  463.  
  464. WARNING: Items stored in the archive is not guaranteed in any way to have
  465. been tested for functionality or absence of virii.  Retrieve and use at your
  466. own risk.
  467.  
  468. Mark Nagel <nagel@ics.uci.edu>
  469. Department of Information and Computer Science
  470. University of California
  471. Irvine, CA  92717
  472. 
  473. 
  474. Path: ucivax!orion.oac.uci.edu!nntpsrv
  475. From: bdugan@teri.bio.uci.edu (Bill Dugan)
  476. Subject: 4.0 substitute for Stdio_Macinit(TRUE) ?
  477. Nntp-Posting-Host: teri.bio.uci.edu
  478. Message-ID: <2800178D.15@orion.oac.uci.edu>
  479. Newsgroups: fa.think-c
  480. Organization: University of California, Irvine
  481. Lines: 10
  482. Date: 8 Apr 91 07:11:09 GMT
  483. Distribution: usa
  484.  
  485. I just loaded an ancient project I made under Think C 3.0, and apparently the
  486. standard library has changed for 4.0; one call won't link:
  487.  
  488. Stdio_MacInit(TRUE);  /* Prevent stdio from making the macintosh init calls */
  489.  
  490. I'm getting an odd-address error when I try running with this commented out,
  491. so I'd assume it is calling some init call twice.  Can anyone help point me
  492. to whatever call is being substituted?  Or am I missing a .h file?
  493.  
  494. bill
  495. 
  496. 
  497. Path: ucivax!gateway
  498. From: jstewart@rodan.acs.syr.EDU (Ace Stewart)
  499. Subject: unsubscribe
  500. Message-ID: <9104081433.AA25811@rodan.acs.syr.edu>
  501. Newsgroups: fa.think-c
  502. Lines: 2
  503. Date: 8 Apr 91 14:35:43 GMT
  504.  
  505.  
  506. unsubscribe
  507. 
  508. 
  509. Path: ucivax!gateway
  510. From: siegel@world.std.COM (Rich Siegel)
  511. Subject: Re:  4.0 substitute for Stdio_Macinit(TRUE) ?
  512. Message-ID: <9104082029.AA07096@world.std.com>
  513. Newsgroups: fa.think-c
  514. Lines: 6
  515. Date: 8 Apr 91 20:34:29 GMT
  516.  
  517. The THINK C 4.0 libraries are now sensitive to whether the Toolbox has
  518. been initialized, so if you perform your own init calls, the console
  519. package will not. Likewise, if you call a console routine such as scanf
  520. or printf before initializing the toolbox, then the console package
  521. will make the calls for you, so you should not call the inits.
  522.  
  523. 
  524. 
  525. Newsgroups: fa.think-c
  526. Path: ucivax!jhummel
  527. From: jhummel@ics.uci.edu (Joseph Edward Hummel)
  528. Subject: help with bison from the think-c archive 
  529. Message-ID: <2802CF68.8920@ics.uci.edu>
  530. Sender: jhummel@ics.uci.edu (Joseph Edward Hummel)
  531. Organization: UC Irvine Department of ICS
  532. Distribution: na
  533. Date: Wed, 10 Apr 1991 08:40:07 GMT
  534. Lines: 18
  535.  
  536. I'm trying to use Bison as ported to the Mac and Think-C by rsfinn at
  537. athena.mit.edu.  The problem is that the yacc.tab.c file produced by Bison
  538. makes calls to "alloca" and "bcopy", both of which do not exist in
  539. Think-C.  Anyone have any ideas on solving this cleanly?
  540.  
  541. [ Note: I can get around the problem by doing "#define yyoverflow", which does
  542. something different instead of going to alloca and bcopy.  But I don't know
  543. what the effect of doing this is, so I'm nervous about this "fix".  I think
  544. it turns off the automatic extension of the stack when it overflows, a feature
  545. I may want to keep. ] 
  546.  
  547. Thanks in advance...
  548.   
  549.   - joe (jhummel@ics.uci.edu)
  550. -- 
  551. Joe Hummel
  552. ICS Graduate Student, UC Irvine
  553. Internet: jhummel@ics.uci.edu
  554. 
  555. 
  556. Path: ucivax!gateway
  557. From: ephraim@think.COM
  558. Subject: Re: help with bison from the think-c archive
  559. Message-ID: <9104101333.AA00559@leander.think.com>
  560. In-Reply-To: Your message of "Wed, 10 Apr 91 08:40:07 GMT."
  561.              <2802CF68.8920@ics.uci.edu>
  562. Newsgroups: fa.think-c
  563. Lines: 17
  564. Date: 10 Apr 91 13:34:53 GMT
  565.  
  566.  
  567. bcopy() is memcpy() with the arguments in a different order.  memcpy()
  568. is the ANSI standard function.
  569.  
  570. #define bcopy(source, dest, length) memcpy(dest, source, (size_t)length)
  571. should do the trick.
  572.  
  573. alloca is a bit more difficult, but was extensively discussed in
  574. comp.sys.mac.programmer a while ago. I could have sworn I saved some
  575. of those articles, but I can't find them now. I don't see anything
  576. likely at sumex, either.
  577.  
  578. Ephraim Vishniac    ephraim@think.com   ThinkingCorp@applelink.apple.com
  579.  Thinking Machines Corporation / 245 First Street / Cambridge, MA 02142
  580.  
  581.         One of the flaws in the anarchic bopper society was
  582.         the ease with which such crazed rumors could spread.
  583. 
  584. 
  585. Path: ucivax!nagel
  586. From: nagel@buckaroo.ics.uci.edu (Mark Nagel)
  587. Subject: Re: help with bison from the think-c archive
  588. Nntp-Posting-Host: buckaroo.ics.uci.edu
  589. Message-ID: <28032D0A.18467@ics.uci.edu>
  590. Newsgroups: fa.think-c
  591. Organization: UC Irvine Department of ICS
  592. Lines: 38
  593. Date: 10 Apr 91 15:19:38 GMT
  594. References: <9104101333.AA00559@leander.think.com>
  595. Distribution: local
  596.  
  597. In <9104101333.AA00559@leander.think.com> ephraim@think.COM writes:
  598.  
  599. >alloca is a bit more difficult, but was extensively discussed in
  600. >comp.sys.mac.programmer a while ago. I could have sworn I saved some
  601. >of those articles, but I can't find them now. I don't see anything
  602. >likely at sumex, either.
  603.  
  604. Here's a copy of an article I saved from some time back.  It is an
  605. assembly version of alloca for MPW C.  I'll leave it to others on
  606. the list to decide whether it is OK for (and modify for) THINK C.
  607. If we come up with a good alloca routine for THINK C, I'll add it to
  608. the archives...
  609.  
  610. ;;
  611. ;; Alloca() for Macintosh Programmer's Workshop C.
  612. ;; alloca(n) allocates n bytes of storage in the stack
  613. ;; frame of the caller.
  614. ;;
  615.         CASE ON
  616.  
  617. alloca PROC EXPORT
  618.         move.l  (sp)+,a0        ; pop return address
  619.         move.l  (sp)+,d0        ; pop parameter = size in bytes
  620.         add.l   #3,d0           ; round size up to long word
  621.         and.l   #-4,d0          ; mask out lower two bits of size
  622.         sub.l   d0,sp           ; allocate by moving stack pointer
  623.         move.l  sp,d0           ; return pointer
  624.         add.l   #-4,sp          ; new top of stack
  625.         jmp     (a0)            ; return to caller
  626.         ENDP
  627.         END
  628.  
  629. Mark
  630. --
  631. Mark Nagel
  632. UC Irvine Department of ICS   +----------------------------------------+
  633. ARPA: nagel@ics.uci.edu       | If you can read this, you're not using |
  634. UUCP: ucbvax!ucivax!nagel     | the Hubble Space Telescope.            |
  635. 
  636. 
  637. Path: ucivax!gateway
  638. From: phils@chaos.cs.brandeis.EDU (Phil Shapiro)
  639. Subject: alloca in THINK C
  640. Message-ID: <9104101741.AA08797@chaos.cs.brandeis.edu>
  641. In-Reply-To: Mark Nagel's message of 10 Apr 91 15:19:38 GMT <28032D0A.18467@ics.uci.edu>
  642. Newsgroups: fa.think-c
  643. Lines: 6
  644. Date: 10 Apr 91 17:42:16 GMT
  645.  
  646. The MPW solution you posted should work; if you're interested, there's
  647. a version of the "portable" GNU alloca() in the gawk package that
  648. somebody ported to THINK C.  I think it's on info-mac, drop me a line
  649. if you can't find it and want more info.
  650.  
  651.     -phil
  652. 
  653. 
  654. Newsgroups: fa.think-c
  655. Path: ucivax!jhummel
  656. From: jhummel@ics.uci.edu (Joseph Edward Hummel)
  657. Subject: solution to Bison problem with alloca and bcopy...
  658. Message-ID: <28035781.11682@ics.uci.edu>
  659. Sender: jhummel@ics.uci.edu (Joseph Edward Hummel)
  660. Organization: UC Irvine Department of ICS
  661. Distribution: na
  662. Date: Wed, 10 Apr 1991 18:20:48 GMT
  663. Lines: 14
  664.  
  665. Thanks for the quick replies to my plea for Bison help.  It turns out that
  666. "bcopy" can be defined using the standard memmove function (I used memmove
  667. in case the blocks overlap, but I guess in this specific case they can't),
  668. and "alloca" can be had by getting the source to Bison.  Bison contains
  669. the portable GNU alloca function (see alloca.c), though you also need the
  670. xmalloc/mallocate functions as well (see allocate.c).
  671.   
  672. Thanks again for the help everyone!
  673.   
  674.   - joe 
  675. -- 
  676. Joe Hummel
  677. ICS Graduate Student, UC Irvine
  678. Internet: jhummel@ics.uci.edu
  679. 
  680. 
  681. Path: ucivax!gateway
  682. From: rsfinn@quark.LCS.MIT.EDU ("Russell S. Finn")
  683. Subject: Re: help with bison from the think-c archive
  684. Message-ID: <9104101901.AA24448@quark.LCS.MIT.EDU>
  685. In-Reply-To: Your message of Wed, 10 Apr 91 08:40:07 +0000.
  686.              <2802CF68.8920@ics.uci.edu>
  687. Newsgroups: fa.think-c
  688. Lines: 14
  689. Date: 10 Apr 91 19:03:27 GMT
  690.  
  691. I haven't actually looked at the source code in quite some time, but
  692. if I remember correctly, the THINK C source code to Bison itself
  693. contains definitions for both alloca and bcopy.  Try poking around in
  694. there for a while (hint: use multi-file search).
  695.  
  696. As others have pointed out, "bcopy" is "bmemcpy" with the arguments
  697. reordered.  Also, the posted version of "alloca" will probably work;
  698. the version I remember being in Bison is a "portable" version which
  699. should also work (but whose actual behavior differs from the usual
  700. version).
  701.  
  702. -- Russell S. Finn
  703. rsfinn@{lcs,athena,}.mit.edu
  704.  
  705. 
  706. 
  707. Path: ucivax!gateway
  708. From: CES00661%UDELVM.bitnet@VTVM2.CC.VT.EDU (Bob Rahe)
  709. Subject: MPW->THINK-C
  710. Message-ID: <9104101808.aa06253@ICS.UCI.EDU>
  711. Newsgroups: fa.think-c
  712. Lines: 15
  713. Date: 11 Apr 91 01:14:11 GMT
  714.  
  715.  
  716.   I've been toying around trying to convert MacKermit from MPW to ThC. I
  717. have been reasonably successful in most areas, in fact found some syntax
  718. errors that MPW lets by apparantly, and some other anomolies, but they
  719. can be handled with ifdefs and such.  One thing has got me really going
  720. tho.  It seems that MPWC knows when to convert strings from C to Pascal
  721. type when calling the toolbox.  And does it "behind your back" as it were.
  722. Seems almost magical at times, 'cause I'd swear he can tell which type
  723. a variable is (maybe not, I don't have an example handy).  Does anyone have
  724. any ideas as to how to go about converting this kind of nastiness, without
  725. the obvious brute force approach of rewriting?  Also, can someone explain
  726. exactly what the algorithm is that MPW-C uses to do this?
  727.  
  728.     Thanks,
  729.      Bob Rahe <CES00661@UDELVM.UDEL.EDU>
  730. 
  731. 
  732. Path: ucivax!gateway
  733. From: phils@chaos.cs.brandeis.EDU (Phil Shapiro)
  734. Subject: MPW->THINK-C
  735. Message-ID: <9104111320.AA28267@chaos.cs.brandeis.edu>
  736. In-Reply-To: Bob Rahe's message of 11 Apr 91 01:14:11 GMT <9104101808.aa06253@ICS.UCI.EDU>
  737. Newsgroups: fa.think-c
  738. Lines: 26
  739. Date: 11 Apr 91 13:22:13 GMT
  740.  
  741.    It seems that MPWC knows when to convert strings from C to Pascal
  742.    type when calling the toolbox.  And does it "behind your back" as
  743.    it were.
  744.  
  745. MPW C does provide an alternate set of toolbox interfaces for most
  746. (all?) toolbox routines that accept strings.  These routines can be
  747. distinguished from the usual toolbox calls since they're entirely in
  748. lowercase.  There isn't anything magical about how they work, MPW C's
  749. glue just calls CtoPstr on a copy of the string before calling the
  750. toolbox.
  751.  
  752. For example:
  753.  
  754. void setctitle(ControlHandle itemHandle, char *theTitle)
  755. {
  756.     Str255 p1;
  757.  
  758.     strcpy((char *)p1, theTitle);
  759.     CtoPstr((char *)p1);
  760.     SetCTitle(itemHandle, p1);
  761. }
  762.  
  763. I suppose it wouldn't be too hard to write a function that copies the
  764. string as it's converted.
  765.  
  766.     -phil
  767. 
  768. 
  769. Path: ucivax!gateway
  770. From: phils@chaos.cs.brandeis.EDU (Phil Shapiro)
  771. Subject: MPW->THINK-C
  772. Message-ID: <9104111327.AA28359@chaos.cs.brandeis.edu>
  773. In-Reply-To: Bob Rahe's message of 11 Apr 91 01:14:11 GMT <9104101808.aa06253@ICS.UCI.EDU>
  774. Newsgroups: fa.think-c
  775. Lines: 71
  776. Date: 11 Apr 91 13:27:27 GMT
  777.  
  778. I'm not sure if I've posted this before, but here's a list of problems
  779. you may encounter when porting code from MPW C to THINK C.  If you can
  780. think of any notes to add to this list, please drop me a line.
  781.  
  782.     -phil
  783. ----
  784.    Phil Shapiro                           Technical Support Analyst
  785.    Language Products Group                     Symantec Corporation
  786.         Internet: phils@chaos.cs.brandeis.edu
  787.  
  788. ---------------- mpwc-to-thinkc.txt ----------------
  789. Here's a list of typical things to look for when converting a MPW C
  790. header/program.  These comments apply to THINK C v4.0x only.
  791.  
  792. (1) The size of the int data type differs between MPW C and THINK C.
  793. MPW C's int is 32 bytes, whereas ours is 16.
  794.  
  795. (2) THINK C does not support the const storage class specifier.
  796. You can use:
  797. #define const
  798.  
  799. (3) pointers to functions
  800. THINK C doesn't support using the pascal keyword in typedefs.  Also,
  801. it doesn't support function pointer types that contain argument lists.
  802. Just use ProcPtr instead.
  803.  
  804. (4) inline function definitions
  805. THINK C only supports pascal inline functions.  These functions can be
  806. rewritten either by using a pascal function, or by using the inline
  807. assembler with dc.w.
  808.  
  809. (5) // comments
  810. A good grep to get rid of these things is:
  811. Replace: "//\(.*\)$"  With: "/*\1 */" (don't type the double quotes)
  812.  
  813. (6) extended type
  814. THINK C's double type corresponds to the SANE extended type.  To make
  815. a header which uses "extended" compatible with THINK C, include the
  816. following statements at the top of the header:
  817.  
  818. #ifdef THINK_C
  819.   #ifndef extended
  820.     #define extended double
  821.   #endif
  822. #endif
  823.  
  824. (7) signed char type
  825. THINK C supports char and unsigned char, but not signed char.
  826. Variables declared as signed char for MPW C should be declared as char
  827. for THINK C.
  828.  
  829. (8) pascal function return types
  830. In THINK C, pascal functions may return only void, integers, or
  831. pointers.
  832.  
  833. (9) THINK C enums are 16 bits
  834. In enums, left shifts of more than 15 bits (1 << 15) will not work.
  835. Use #define instead.
  836.  
  837. (10) comp
  838. THINK C doesn't support the comp data type
  839.  
  840. (11) pascal function argument size
  841. In THINK C, parameters to pascal functions must be no larger than 4
  842. bytes.  Instead of passing large structs, pass pointers to these
  843. structs.  (Also, instead of passing a Str255 or Str32, pass a
  844. StringPtr.)
  845.  
  846. (12) foo[0]
  847. THINK C will flag "fooType foo[0];" with an "illegal array bounds"
  848. error.  Use "fooType foo[1];" instead.
  849. 
  850. 
  851. Path: ucivax!gateway
  852. From: jbr@cblph.att.COM
  853. Subject: More Problems With Dialog Class
  854. Message-ID: <9104110650.aa25218@ICS.UCI.EDU>
  855. Newsgroups: fa.think-c
  856. Original-From: cblph!jbr (j.a.brownlee)
  857. Lines: 26
  858. Date: 11 Apr 91 13:53:28 GMT
  859.  
  860. I solved my problem with the Dispose method in my Dialog class.  I now have an
  861. approach question.  As per one of the Tech Notes (#38?), I am using a real
  862. window for my dialogs, since the "dialog" could potentially have many controls.
  863. However, this leads to some problems with modality.
  864.  
  865. I'd like to be able to support "modal" dialogs (or perhaps semi-modal is more
  866. accurate?).  By this, I mean that it would be OK for the user to switch
  867. applications, but I want the current application to be "frozen" until the user
  868. makes a selection.  To accomplish this, I would at least need to disable all of
  869. the menus in the application and to prevent the user from activating another
  870. of the application's windows.  Have I missed anything here?
  871.  
  872. Assuming the above to be correct, there is no general way in the TCL to disable
  873. all of the menus that I can see.  To do it, you must know all of the menu IDs.
  874. I suppose I could add such a method to CBartender.  However, I know of no way
  875. to keep the user from selecting another window unless I try to grab all of the
  876. events for myself and only act on clicks in my dialog window.  Would this be a
  877. better approach to the problem?  If I take this approach, how much will this
  878. cause problems for supporting modeless dialogs?
  879.  
  880. Any advice from all of you TCL gurus is greatly appreciated.  Thanks.
  881.  
  882.    -      _   Joe Brownlee, Analysts International Corporation @ AT&T Bell Labs
  883.   /_\  @ / `  471 E Broad St, Suite 1610, Columbus, Ohio 43215   (614) 860-7461
  884.  /   \ | \_,  E-mail: jbr@cblph.att.com     Who pays attention to what _I_ say?
  885.  "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
  886. 
  887. 
  888. Path: ucivax!gateway
  889. From: ehorvath@attmail.COM
  890. Subject: MPW->THINK-C : string conversions
  891. Original-From: attmail!ehorvath (Ned Horvath )
  892. Lines: 51
  893. Date: 11 Apr 91 15:15:39 GMT
  894. Phone: +1 908 671 7100
  895. Message-ID: <9104110812.aa02873@ICS.UCI.EDU>
  896. In-Reply-To: your message <internet1010134230> of Thu Apr 11 01:14:11 GMT 1991
  897. >To: internet!ics.uci.edu!think-c
  898. Content-Type: text
  899. Content-Length: 2413
  900. Newsgroups: fa.think-c
  901. Message-Version: 2
  902. EMail-Version: 2
  903. UA-Message-ID: <MAC-1.3.4A1-618034-ehorvath-356>
  904. UA-Content-ID: <MAC-1.3.4A1-618034-ehorvath-356>
  905. MTS-Message-ID: <ehorvath1011500470>
  906.  
  907. ------------ Original Message -------------
  908.   I've been toying around trying to convert MacKermit from MPW to ThC. I
  909. have been reasonably successful in most areas, in fact found some syntax
  910. errors that MPW lets by apparantly, and some other anomolies, but they
  911. can be handled with ifdefs and such.  One thing has got me really going
  912. tho.  It seems that MPWC knows when to convert strings from C to Pascal
  913. type when calling the toolbox.  And does it "behind your back" as it were.
  914. Seems almost magical at times, 'cause I'd swear he can tell which type
  915. a variable is (maybe not, I don't have an example handy).  Does anyone have
  916. any ideas as to how to go about converting this kind of nastiness, without
  917. the obvious brute force approach of rewriting?  Also, can someone explain
  918. exactly what the algorithm is that MPW-C uses to do this?
  919.  
  920.     Thanks,
  921.      Bob Rahe <CES00661@UDELVM.UDEL.EDU>
  922. --------- End of Original Message ---------
  923.  
  924. Look carefully at the trapnames used: unlike pascal, C distinguishes names
  925. based on case.  So, Apple provides TWO sets of traps in MPW C, one set with
  926. implicit string conversions, one without.  BUT (isn't this fun?) Apple also
  927. CHANGED THE RULES between MPW 2 and 3, so the vintage of your source affects
  928. the interpretation:
  929.  
  930. In MPW 2.x, you could call (for example) either
  931.         DrawString ("a string");
  932. or
  933.         DRAWSTRING ("\Pa string");
  934. i.e. the normal, mixed-case trap name got you a free conversion from C to
  935. pascal on the way into the toolbox, and (where necessary, like "GetVol") on
  936. the way out.  The all-uppercase trap was the "real," unadorned, do me no
  937. favors trap.  The mixed-case trap also converted int (which is the same as
  938. long in MPW C) to short for you (this shouldn't be a problem in ThinkC, which
  939. will demote longs when they're passed to traps expecting shorts).
  940.  
  941. In MPW 3.x, the rules changed: now you use
  942.         DrawString ("\Pa string");
  943. or
  944.         drawstring ("a string");
  945. i.e. now the all-lower name gets the free conversions, and the mixed-case name
  946. is the unadorned trap.
  947.  
  948. To add to the confusion, whether you call SFGETFILE, sfgetfile, or SFGetFile,
  949. the trap will NOT attempt convert the filename in the SFReply record.  This
  950. leads to a lot of FUD (Fear, Uncertainty, and Doubt).  I, and most C
  951. programmers I respect :-) avoid the funny traps altogether -- it makes for a
  952. simpler mental model.
  953.  
  954. Hope that helps.
  955.  
  956. =Ned Horvath=
  957. ehorvath@attmail.com
  958. 
  959. 
  960. Path: ucivax!gateway
  961. From: nagel@ICS.UCI.EDU (Mark Nagel)
  962. Subject: ARCHIVE: THINK C version of regcomp/regexp
  963. Message-ID: <16210.671389827@ics.uci.edu>
  964. Newsgroups: fa.think-c
  965. Reply-To: think-c-request@ICS.UCI.EDU
  966. Organization: University of California, Irvine - Dept of ICS
  967. Lines: 15
  968. Date: 11 Apr 91 17:16:34 GMT
  969. Phone: (714) 856-5039
  970.  
  971. Date:    Wed, 10 Apr 91 21:31:00 EDT
  972. From:    arch3!dsk@cbnewsj.att.COM (Donald S Klett +1 908 949 2283)
  973. Subject: Re: THINK C version of regcomp/regexp
  974.  
  975. The regular expression set of C subroutines developed by Henry Spencer at the
  976. University of Toronto has been ported to run under THINK C 4.02.  I would be
  977. happy to e-mail copies of the source to anyone that makes the request.  The
  978. ported code passes the "test" file included with the original source from
  979. Toronto.
  980.  
  981.         Don Klett
  982.         att!arch3!dsk
  983.         (908)949-2283
  984.  
  985. [saved as: /mac/think-c/code/regex.hqx; 52K]
  986. 
  987. 
  988. Path: ucivax!gateway
  989. From: ephraim@think.COM
  990. Subject: Re: MPW->THINK-C
  991. Message-ID: <9104111746.AA03078@leander.think.com>
  992. In-Reply-To: Your message of "11 Apr 91 13:27:27 GMT."
  993.              <9104111327.AA28359@chaos.cs.brandeis.edu>
  994. Newsgroups: fa.think-c
  995. Lines: 15
  996. Date: 11 Apr 91 17:48:02 GMT
  997.  
  998.  
  999. Another major headache in MPW->Think C conversion is low memory
  1000. globals.  MPW defines low memory globals as constant addresses, which
  1001. you have to cast to the appropriate pointer type in order to use them.
  1002. Think C, much more logically, defines low memory globals as data items
  1003. of the appropriate type at a fixed address.
  1004.  
  1005. It's a real pain to find all these short of examining every cast to
  1006. pointer type in a program.
  1007.  
  1008. Ephraim Vishniac    ephraim@think.com   ThinkingCorp@applelink.apple.com
  1009.  Thinking Machines Corporation / 245 First Street / Cambridge, MA 02142
  1010.  
  1011.         One of the flaws in the anarchic bopper society was
  1012.         the ease with which such crazed rumors could spread.
  1013. 
  1014. 
  1015. Path: ucivax!gateway
  1016. From: Mark.Alldritt@vancouver.osiware.bc.ca (Mark Alldritt)
  1017. Subject: Curses
  1018. Message-ID: <910411961*Mark.Alldritt@Vancouver.osiware.bc.ca>
  1019. Newsgroups: fa.think-c
  1020. Lines: 8
  1021. Date: 11 Apr 91 21:29:06 GMT
  1022.  
  1023. Hello,
  1024.  
  1025. Does anyone know of a PD curses library for Think-C (supports the console
  1026. library).  Failing that, is there a GNU one that I could port?
  1027.  
  1028. Thanks in advance,
  1029.  
  1030. -Mark
  1031. 
  1032. 
  1033. Path: ucivax!gateway
  1034. From: well!crunch@apple.COM (John Draper)
  1035. Subject: Some good and bad things about TCL
  1036. Message-ID: <9104150201.AA10220@well.sf.ca.us>
  1037. Newsgroups: fa.think-c
  1038. Lines: 69
  1039. Date: 15 Apr 91 02:53:52 GMT
  1040.  
  1041.     One of the greatest things that really influenced me into purchasing
  1042. Think C Ver 4.0 and the Class Library was the straight forward approach
  1043. to Macintosh application development.
  1044.  
  1045.     The manual was pretty well written and fairly easy to understand,
  1046. at least for an "Average level" programmer.   But,  there is a hidden
  1047. little "Gotcha!!" that has gotten little mention in any of the user
  1048. groups and Network discussion,   but would have influenced my decision
  1049. to use Think C,  had I known about it.    I'm sure that some casual
  1050. mention might have been made,   but I don't have the time to read
  1051. ALL net traffic.
  1052.  
  1053.     So now,  here is the Gotcha! that I discovered which should
  1054. be pointed out to those people thinking of seriously using TCL
  1055. to develop a product.
  1056.  
  1057.     The problem is the CPanorama class,  and it's inability to handle
  1058. large panoramas which span beyond a pixel range of 32,767 pixels in
  1059. either the vert of horizontal direction.    If your application will
  1060. NEVER go beyond that range,  then please ignore this note.    But if
  1061. you are developing a CAD program,   or any other program that displays
  1062. objects in a large panorama exceeding the 32,767 pixel range,  then
  1063. I strongly urge you to either consider using MacApp,  or another
  1064. Class library,   or to write a letter to Symantic to urge them to
  1065. re-write CPanorama class,  or better yet to have someone else re-write
  1066. CPanorama.    Perhaps the people at Lexington Software Design (Prepare
  1067. Newsletter) might want to implement a new version of CPanorama and
  1068. CScrollPane to deal with this serious problem.    I would be glad to
  1069. do this myself,   but I neither have the time,  nor the know how to
  1070. do a good job,  and now have to explain to an un-forgiving client,  and
  1071. take a large financial lose as a result of this trap.
  1072.  
  1073.     So,  I would like to hear from those folks at Symantic who have
  1074. made appearances here in the past,   and what they have to say about
  1075. this.    For instance,  why hasn't there been a mention in the manual
  1076. about this serious limitation??   Nor has there been any mention in
  1077. the so called well commented source code.    It took me weeks to
  1078. un-ravel the intricate TCL scrolling and display mechanism to determine
  1079. this limitation.    So I am posting this to tell others about this
  1080. serious problem in the hopes that others won't fall into this trap,  and
  1081. that first-time users of TCL should carefully examine for other flaws
  1082. and "Gotchas!".
  1083.  
  1084.     I am not on Internet,  so don't have access to the Think C Archive,
  1085. and would appreciate it if someone could Email me a list of what is
  1086. up there.   I am particularly interested in knowing if there is a fix
  1087. for the CPanorama's 32k pixel limit,   or an alternate mechanism
  1088. for dealing with this problem,  plus I have some code that might be
  1089. of interest to those implementing Modal Dialogs as Objects,  and
  1090. it uses the DITL format so ResEdit can be used.    It also allows
  1091. ResEdit to specify "user items" as custom TCL panes.    I was hoping
  1092. to have gotten this put together a lot sooner,   but fell into this
  1093. trap,  so it might be a while now before I can spare the time to
  1094. get it ready for Public domain use.    It took me a long time to
  1095. put this together and get it working in conjunction with the Mac
  1096. Dialog Mgr.   It was NOT a trivial task to accomplish,  as it took
  1097. lots of digging around in ROM code to figure out how to do it.
  1098.  
  1099.     I also just got AppMaker Ver 1.1 which generates TCL code,  and
  1100. want to know what other people think of this product.    I haven't had
  1101. a chance to use it yet,  but want to know if it was worth the money.
  1102.  
  1103. Thanx in advance...
  1104. John D.
  1105.  
  1106. crunch@well.sf.ca.us
  1107.  
  1108.  
  1109.  
  1110. 
  1111. 
  1112. Path: ucivax!gateway
  1113. From: nick@lfcs.edinburgh.ac.UK (Nick Rothwell)
  1114. Subject: Re: Some good and bad things about TCL
  1115. Message-ID: <19820.9104151201@lfcs.ed.ac.uk>
  1116. Newsgroups: fa.think-c
  1117. Lines: 17
  1118. Date: 15 Apr 91 12:12:51 GMT
  1119.  
  1120. >I would be glad to
  1121. >do this myself,   but I neither have the time,  nor the know how to
  1122. >do a good job,  and now have to explain to an un-forgiving client,  and
  1123. >take a large financial lose as a result of this trap.
  1124.  
  1125. The Macintosh is a 16-bit system. The 68000 is a 16-bit chip and the 68030
  1126. Macs have the same software environment. This is very common knowledge
  1127. (although there are enough queries about people wondering why printing out
  1128. an integer value of 100000 doesn't work). It's inconvenient, but it's no
  1129. particular weakness of the TCL. If you want to flame Symantec, fine, but if
  1130. you go around assuming you've got 32-bit ints everywhere you're going to
  1131. fall over again, and rather soon, I expect.
  1132.  
  1133. ... an eye for an eye, a flame for a flame... :-)
  1134.  
  1135.         Nick.
  1136.  
  1137. 
  1138. 
  1139. Path: ucivax!gateway
  1140. From: Rick_Holzgrafe.PINKTEAM@gateway.qm.apple.COM (Rick Holzgrafe)
  1141. Subject: Re- Some good and bad thing
  1142. Message-ID: <9104151742.AA11874@internal.apple.com>
  1143. Newsgroups: fa.think-c
  1144. Lines: 23
  1145. Date: 15 Apr 91 17:47:19 GMT
  1146.  
  1147.  Internet Mail          Re: Some good and bad things about TCL
  1148. John Draper <well!crunch@apple.COM> writes:
  1149. >    The problem is the CPanorama class,  and it's inability to handle
  1150. large panoramas which span beyond a pixel range of 32,767 pixels in
  1151. either the vert of horizontal direction.
  1152.  
  1153. QuickDraw itself uses signed 16-bit integers for pixel addressing. All
  1154. Macintosh developers have had to take this into account, except for those using
  1155. MacApp, which jumps through hoops to present a 32-bit graphic interface.
  1156.  
  1157. Note that QuickDraw is not the only part of the Toolbox which has this
  1158. limitation. Standard scroll bars, for example, have a maximum range of -32767
  1159. to 32,767.
  1160.  
  1161. -----------------------------------------------------
  1162. Rick Holzgrafe   rmh@apple.com   AppleLink HOLZGRAFE1
  1163.      {sun,voder,nsc,mtxinu,dual}!apple!rmh
  1164. Apple Computer, Inc.
  1165. 20525 Mariani Ave. MS: 3-PK
  1166. Cupertino, CA 95014
  1167.  
  1168.  
  1169.  
  1170. 
  1171. 
  1172. Path: ucivax!gateway
  1173. From: jbr@cblph.att.COM
  1174. Subject: Re: Some good and bad things about TCL
  1175. Message-ID: <9104151512.aa16291@ICS.UCI.EDU>
  1176. Newsgroups: fa.think-c
  1177. Original-From: cblph!jbr (j.a.brownlee)
  1178. Lines: 22
  1179. Date: 15 Apr 91 22:16:57 GMT
  1180.  
  1181. > John Draper <well!crunch@apple.COM> writes:
  1182. >    The problem is the CPanorama class,  and it's inability to handle
  1183. > large panoramas which span beyond a pixel range of 32,767 pixels in
  1184. > either the vert of horizontal direction.
  1185.  
  1186. For most applications (as you yourself say) this is not a problem.  However,
  1187. your statement that it is not "documented" isn't really true.  First, QuickDraw
  1188. itself is limited to 64K pixels in each direction (see IM-I).
  1189.  
  1190. Second, I find the TCL to be _very_ clear about such limits.  There aren't many
  1191. (at least none I can recall) parameters to any of the methods that aren't
  1192. defined as either "long" or "short" -- not type "int".  This to me is an
  1193. explicit statement about the range of values allowed for such parameters.  I
  1194. don't know about others, but one of the first things I check out when using a
  1195. new C implementation is the size of the various data types.  Therefore, the
  1196. allowable ranges are known immediately upon checking the types of a given
  1197. method's arguments.
  1198.  
  1199.    -      _   Joe Brownlee, Analysts International Corporation @ AT&T Bell Labs
  1200.   /_\  @ / `  471 E Broad St, Suite 1610, Columbus, Ohio 43215   (614) 860-7461
  1201.  /   \ | \_,  E-mail: jbr@cblph.att.com     Who pays attention to what _I_ say?
  1202.  "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
  1203. 
  1204. 
  1205. Path: ucivax!gateway
  1206. From: watanabe@cs.uiuc.EDU (Larry Watanabe)
  1207. Subject: Re: Some good and bad things about TCL
  1208. Message-ID: <9104160247.AA07408@milton.cs.uiuc.edu>
  1209. Newsgroups: fa.think-c
  1210. Lines: 25
  1211. Date: 16 Apr 91 02:49:43 GMT
  1212.  
  1213.  
  1214. I think I have to come to defense of the person who is having
  1215. problems with the 16-bit limit of CPanorama. First, the limits
  1216. of Quickdraw are independent of the limits of CPanorama. It is
  1217. reasonable to have 16-bit limits on Quickdraw, as that is likely
  1218. all will need to draw to the screen (barring ultra-large monitors!).
  1219.  
  1220. However, it is perfectly reasonable to expect to be able to draw
  1221. very large documents that have a virtual extent much larger than
  1222. 32,767 pixels in either direction. I think a thesis might qualify.
  1223.  
  1224. It wouldn't have been that hard to represent the position and
  1225. bounds using 32-bit integers. The limits of the scrollbars
  1226. aren't relevant, as you can always map more than 1 pixel to
  1227. a particular scrollbar pixel. In fact, the think c library
  1228. already supports this to some extent.
  1229.  
  1230. Although the Think Class library is clear about such limits,
  1231. I don't think that qualifies as an excuse for not supporting
  1232. larger Panoramas. I'm not blaming the implementers of the Think
  1233. Class library, as it is hard to determine these requirements
  1234. in advance. But how about a larger panorama class, and larger
  1235. textedit class, in the next release?
  1236.  
  1237. -Larry Watanabe watanabe@cs.uiuc.edu
  1238. 
  1239. 
  1240. Path: ucivax!gateway
  1241. From: autodesk!henry!glang@fernwood.mpk.ca.US (Gary Lang)
  1242. Subject: Some good and bad things about TCL
  1243. Message-ID: <9104160717.AA02160@henry>
  1244. In-Reply-To: jbr@cblph.att.com's message of 15 Apr 91 22:16:57 GMT <9104151512.aa16291@ICS.UCI.EDU>
  1245. Newsgroups: fa.think-c
  1246. Lines: 5
  1247. Date: 16 Apr 91 08:12:42 GMT
  1248.  
  1249. Also BTW, contrary to FBI reports, John is not the CEO of Autodesk.
  1250. Whether this is good or bad is hard to say ;-)
  1251.  
  1252. -g
  1253.  
  1254. 
  1255. 
  1256. Path: ucivax!gateway
  1257. From: autodesk!henry!glang@fernwood.mpk.ca.US (Gary Lang)
  1258. Subject: Some good and bad things about TCL
  1259. Message-ID: <9104160716.AA02155@henry>
  1260. In-Reply-To: jbr@cblph.att.com's message of 15 Apr 91 22:16:57 GMT <9104151512.aa16291@ICS.UCI.EDU>
  1261. Newsgroups: fa.think-c
  1262. Lines: 9
  1263. Date: 16 Apr 91 08:13:32 GMT
  1264.  
  1265. BTW Draper is just sore because his protege wrote TCL and made good
  1266. with it, when the whole idea was his in the first place. Not knowing
  1267. the whole story except from various product managers from
  1268. Symantec/Think, it sounds to me like if Dow hadn't gotten the go ahead
  1269. from them to di it, the Crunch Shell may or may not have produced
  1270. anything as useful. What say you cap'n?
  1271.  
  1272. -g
  1273.  
  1274. 
  1275. 
  1276. Path: ucivax!gateway
  1277. From: nick@lfcs.edinburgh.ac.UK (Nick Rothwell)
  1278. Subject: Re: Some good and bad things about TCL
  1279. Message-ID: <690.9104161001@lfcs.ed.ac.uk>
  1280. Newsgroups: fa.think-c
  1281. Lines: 45
  1282. Date: 16 Apr 91 10:18:42 GMT
  1283.  
  1284. >I couldn't disagree more with the intent of the above. The mac's 16 bit
  1285. >past should be long burried by now. Even MPW uses 32bit ints.
  1286.  
  1287. I agree that this *should* be the case - I was just saying that it isn't. I
  1288. don't know offhand what the performance penalty is on a 68000 if you do
  1289. everything in longs, but I would probably settle for that in exchange for a
  1290. unified 32-bit environment.
  1291.  
  1292. The only argument against this (and not a very good one) is that most of
  1293. the Toolbox believes in 16-bit ints. I would have nothing against spec'ing
  1294. them as taking shorts, however.
  1295.  
  1296. >When I first
  1297. >started program with ThinkC -- I would constantly get bit by the
  1298. assumption
  1299. >that I could use 'int' and expect rational behaviour (i.e. the 32 bit
  1300. behaviour
  1301. >that I was used to).
  1302.  
  1303. I've been using 32-bit machines for years (since the VAX in 1978), but
  1304. approached the Mac knowing that int = 16 bits (the Mac is only a personal
  1305. home computer, after all). Occasionally I'll trip over it (when some
  1306. constant #defined as a complex arithmetic expression works out at 34688
  1307. bytes, for example) but usually it's no problem.
  1308.  
  1309. Now, if you view the Mac as a workstation machine for CAD applications and
  1310. so on, yes, 16 bits for integers is pretty silly.
  1311.  
  1312. >I finally overcame this problem by the resolution to 'never mutter the
  1313. "int"
  1314. >word again'. Nowadays, everything is either a short or a long -- and if I
  1315. should
  1316. >call printf -- I generally cast all of the arguments to longs and use %ld.
  1317.  
  1318. Yup - I will probably end up doing this as well (and aliasing `int' to
  1319. something illegal).
  1320.  
  1321. >True -- this is not as efficient as it might be, but my debugging time is
  1322. more
  1323. >valuable then a few extra cycles of execution time.
  1324.  
  1325. Couldn't agree more.
  1326.  
  1327.         Nick.
  1328.  
  1329. 
  1330. 
  1331. Path: ucivax!gateway
  1332. From: s57783@zeus.usq.edu.au (chapman alan)
  1333. Subject: How to do this window?
  1334. Message-ID: <9104171541.AA21020@zeus.usq.edu.au>
  1335. Newsgroups: fa.think-c
  1336. Lines: 34
  1337. Date: 17 Apr 91 05:43:09 GMT
  1338.  
  1339. I have recently been asked to assist on a research project to test the
  1340. benefits of a couple of different menu structures for an editor environment.
  1341. I have programming in C for quite a while but I have only dabbled in the Mac
  1342. environment (programming wise) a bit since I purchased Think C 4.0 about six
  1343. months ago.  I wonder what would be the best approach to the following problem:
  1344.  
  1345. I need to have a couple of windows on the screen (no menubar), upon the user
  1346. clicking the mouse, a further window opens up.  This window will have some
  1347. boxes containing some text linked by lines (indicating structure).  The mouse
  1348. pointer should then be moved into this window and the user allowed to move it
  1349. anywhere from there.  As the mouse is moved over the boxes in the window they
  1350. should highlight and dehighlight as the mouse is moved out of the box.  When
  1351. the user clicks in one of the boxes the scene ends and the number of the
  1352. selection is returned.  There are several other cosmetic things which should be
  1353. simple enough.  There is also an alternative menu style which we will be
  1354. testing also.  It involves a very similar approach but with indented lines of
  1355. text to indicate structure rather than lines and boxes.
  1356.  
  1357. Bear in mind that this is testing only for reseach purposes, so please no
  1358. flames about not using the standard mac interface guidelines.  The final
  1359. editor will most likely not even be on the Mac.
  1360.  
  1361. I would like as many ideas and recommendations as possible (general or
  1362. specific).  I would like to consider using the Think C Class libraries and
  1363. object oriented programming approach.  Is this advisable?
  1364.  
  1365. We have several books on order (Inside Macintosh Volumes and several other
  1366. books I have seen recommended on the network).
  1367.  
  1368. Thanks in Advance,
  1369. -----------------------------------------------------------------------------
  1370. Alan Chapman, Tutor, School of Info. Tech.| email : s57783@zeus.usq.edu.au
  1371. UCSQ, Toowoomba QLD 4350, Australia.      | "PC's and me just don't agree!"
  1372. -----------------------------------------------------------------------------
  1373. 
  1374. 
  1375. Path: ucivax!gateway
  1376. From: fjlim@garnet.berkeley.EDU
  1377. Subject: TCL history
  1378. Message-ID: <9104170953.AA13412@garnet.berkeley.edu>
  1379. Newsgroups: fa.think-c
  1380. Lines: 60
  1381. Date: 17 Apr 91 09:57:22 GMT
  1382.  
  1383. In a recent message, Gary Lang wrote:
  1384.  
  1385. > BTW Draper is just sore because his protege wrote TCL and made good
  1386. > with it, when the whole idea was his in the first place. Not knowing
  1387. > the whole story except from various product managers from
  1388. > Symantec/Think, it sounds to me like if Dow hadn't gotten the go ahead
  1389. > from them to di it, the Crunch Shell may or may not have produced
  1390. > anything as useful. What say you cap'n?
  1391.  
  1392. As the author of the TCL, let me set the record straight.
  1393.  
  1394. First, I am not a protege of Draper. I am not a protege of anyone, with
  1395. the possible exception of my parents.
  1396.  
  1397. Scond, the TCL was _not_ Draper's idea. Draper had a concept for something
  1398. he called the "Crunched Shell." This was something like a glorified version
  1399. of TranSkel, a generic application framework. It was not object-oriented.
  1400. His idea was to have a group of programmers work on this project. He posted
  1401. messages on various BBS's asking for participants. Several people responded,
  1402. but I was the only one who actually did some work and shared the code
  1403. with Draper. Draper had some generic event loop and window management code
  1404. that we used as a starting point. For a while, we each added stuff and
  1405. exchanged the code.
  1406.  
  1407. At some point, Draper took an Apple Developer University course on OOP and
  1408. MacApp. He recommended that I read Kurt Schmucker's book "Object-Orient
  1409. Programming for the Macintosh." After reading this book, I started to write
  1410. my own generic framework, using OOP techniques. I was using THINK C 2.0 at
  1411. the time, which didn't even have a hint of OOP. I developed my own way
  1412. of message dispatching, using the preprocessor, function pointers, and a
  1413. little in-line assembly. I wrote all the code, but for a while, I shared
  1414. it with Draper.
  1415.  
  1416. During this time, Draper introduced me to Jorg Brown, who went on to
  1417. work at Symantec. At some point, I stopped giving all my code to Draper.
  1418. He kept annoying me with programming questions at all hours of the night.
  1419. The worst was when a police officer knocked on my door at midnight. The
  1420. officer told me that it was urgent to call Draper. Turns out that Draper
  1421. had a programming question, and was frustrated that he couldn't get thru
  1422. to me because my phone was busy for a couple hours (I was using my modem).
  1423. I later found out that he also got a phone operator to try and break in
  1424. on my line, claiming it was a medical emergency.
  1425.  
  1426. After the Boston MacWorld Expo in 1988, I got a call from Jorg regarding
  1427. my pseudo-OOP class library. Draper had shown a version of my code to
  1428. someone at Symantec, and Symantec was interested in including a class library
  1429. with their upcoming THINK C 4.0 package. Jorg knew that I, not Draper, had
  1430. written the code.
  1431.  
  1432. Eventually, I worked out a contract with Symantec to develop the TCL. I
  1433. had to rewrite everything to use the OOP syntax supported by the new
  1434. compiler. As with any rewrite, I made a lot of design changes, learning
  1435. from by past mistakes.
  1436.  
  1437. Anyway, the point of this whole story is that Draper had very little to do
  1438. with the TCL. At most, he can be credited with recommending that I read
  1439. Kurt Schmucker's book, introducing me to Jorg Brown, and showing some of
  1440. my code to Symantec.
  1441.  
  1442. -- Greg Dow
  1443. 
  1444. 
  1445. Path: ucivax!gateway
  1446. From: tj@cs.ucla.edu (Tom Johnson)
  1447. Subject: CommToolBox/TCL
  1448. Message-ID: <9104171013.aa22225@ics.uci.edu>
  1449. Newsgroups: fa.think-c
  1450. Lines: 47
  1451. Date: 17 Apr 91 17:17:25 GMT
  1452.  
  1453.                CommToolBox/TCL
  1454. Hello all,
  1455.  
  1456. I'm working on a CommToolBox application using the Think Class Library, and
  1457. I've hit upon a major stumbling block.  I'll explain my problem, and hopefully
  1458. someone out there has some ideas or has tried to do something similar in the
  1459. past.
  1460.  
  1461. Problem:
  1462.    Part A:   When using an CTB Connection and/or terminal, the application must
  1463. call a few routines to make sure that the CTB gets events.  Some are pretty
  1464. easy to handle with TCL--I simply created a subclass of CChore to handle the
  1465. CMIdle and TMIdle calls.  But a couple are not so simple.  Most specifically
  1466. CMEvent, TMEvent, and FTEvent.  These calls allow the various CTB routines to
  1467. handle events meant for them.  To quote fromt he documentation for CMEvent:
  1468.    "When your application receives an event, it should check if the refcon of
  1469. the window is a tool's ConnHandle.  Such an event occurs, for example, when the
  1470. user clicks a button in a dialog box displayed by the connection tool.  If it
  1471. does belong to a connection tool's window, your application should call
  1472. CMEvent."
  1473.   The TCL documentation states recommends against modifying the TCL source, but
  1474. states "If you need to keep track of events as the Event Manager gets them,
  1475. it's probably easier to modify the CSwitchboard class to do this than to create
  1476. a subclass."  It sounds like this is what I want to do.  Any comments?
  1477.  
  1478.    Part B:  It appears that the TCL stores in a window's refCon field a pointer
  1479. to the CWindow object.  This is gonna make things a bit more difficult.  I'll
  1480. have to grab the refCon of the window, and then try to figure out if the refCon
  1481. is a CWindow *, a ConnHandle, a TermHandle, or an FTHandle.  I suppose I can
  1482. create a CList which contains a list of the CTB handles I create, and each time
  1483. through the event loop I could check to see if the refCon of the FrontWindow is
  1484. one of the handles in the list, but this seems rather slow and clumsy.  I don't
  1485. like the idea of doing that much processing every time through the event loop.
  1486. Or am I being paranoid?  Does anybody have any better ideas for a way to handle
  1487. this?
  1488.  
  1489. To recap my questions:  Should I go ahead and just modify CSwitchboard to
  1490. handle the CMEvent, TMEvent and FTEvent routines?  How should I determine
  1491. whether to call the CMEvent, TMEvent, or FTEvent? Does anybody have some sample
  1492. source code for the CommToolbox?
  1493.  
  1494. Thanks-
  1495.  
  1496. Tom
  1497. tj@cs.ucla.edu
  1498.  
  1499.  
  1500. 
  1501. 
  1502. Path: ucivax!gateway
  1503. From: autodesk!henry!glang@fernwood.mpk.ca.us (Gary Lang)
  1504. Subject: TCL history
  1505. Message-ID: <9104171711.AA02974@henry>
  1506. In-Reply-To: fjlim@garnet.berkeley.edu's message of 17 Apr 91 09:57:22 GMT <9104170953.AA13412@garnet.berkeley.edu>
  1507. Newsgroups: fa.think-c
  1508. Lines: 28
  1509. Date: 17 Apr 91 17:17:59 GMT
  1510.  
  1511. Thanks Greg for basically explaining what I was trying to say. That is
  1512. if you hadn't done it, it wouldn't have happenned... Sorry if the word
  1513. protege offended you; it wasn't necessarily an attempt at accurately
  1514. characterizing you at all.
  1515.  
  1516. However, the fact that John started the idea and that you were one
  1517. of those that responded but was "the only one that did some work"
  1518. means that it was his idea and that you started work on it as
  1519. a response to his missives. Just because he ended up being in the
  1520. way at some point doesn't erase the fact that you weren't doing
  1521. this until Draper did his call to arms over the net. That makes you
  1522. a protege at some level. But please, I give full credit to you
  1523. for excellent work. But you yourself are admitting that he started the
  1524. ball rolling on the idea. Why deny him that? Noone said he wrote one
  1525. line of TCL, certainly I didn't.
  1526.  
  1527. "At most, he can be credited with recommending that I read
  1528. Kurt Schmucker's book, introducing me to Jorg Brown, and showing some of
  1529. my code to Symantec. "
  1530.  
  1531. I see. He gave you the idea, pointed you to literature that made your
  1532. project useful, and gave you a contact at the company that ultimately
  1533. published your work. Boy, he didn't have much to do with TCL did he?
  1534. Come on now, give him a break.
  1535.  
  1536. -g
  1537.  
  1538.  
  1539. 
  1540. 
  1541. Path: ucivax!gateway
  1542. From: well!crunch@apple.com (John Draper)
  1543. Subject: Thanx for the help...
  1544. Message-ID: <9104171946.AA09216@well.sf.ca.us>
  1545. Newsgroups: fa.think-c
  1546. Lines: 35
  1547. Date: 17 Apr 91 22:25:21 GMT
  1548.  
  1549. I want to thank everyone for their responses.    They have been most
  1550. helpful after filtering out some of the flames.    I cannot know
  1551. if these responses were sent to me privatly,  or if they went out
  1552. to other people in the mailing list.    I am not familiar with the
  1553. mechanism of mailing lists,  so I'll summarize the responses for
  1554. those new folks who might ALSO be interested in the responses.
  1555.  
  1556. Larry writes.....
  1557.  
  1558. >I think I have to come to defense of the person who is having
  1559. >problems with the 16-bit limit of CPanorama. First, the limits
  1560. >of Quickdraw are independent of the limits of CPanorama.
  1561.  
  1562. >It wouldn't have been that hard to represent the position and
  1563. >bounds using 32-bit integers. The limits of the scrollbars
  1564. >aren't relevant, as you can always map more than 1 pixel to
  1565. >a particular scrollbar pixel. In fact, the think c library
  1566. >already supports this to some extent.
  1567.  
  1568. Thanx Larry,  I can use all the encouragement I can get right now.
  1569.  
  1570. Yikes!!   The "flame factor" was pretty high on this posting...
  1571. I was just posting something that would help out a first time
  1572. TCL user,   something that if I had known earlier,   it would
  1573. have changed my decision to use TCL for this project in the
  1574. first place.  I admit to being a "weenie" as far as programming
  1575. goes.   I only wish I had access to this mailing list when I
  1576. first started using TCL.    I had NO contact with other TCL users
  1577. until 8 months later,  nor did I expect to get this many responses.
  1578.  
  1579. Many thanx for the replies and information.   And a special thanx
  1580. to the person or persons managing this mailing list,   for he is
  1581. doing a valuable service to all of us TCL users.
  1582.  
  1583.  
  1584. 
  1585. 
  1586. Path: ucivax!gateway
  1587. From: autodesk!henry!glang@fernwood.mpk.ca.us (Gary Lang)
  1588. Subject: TCL history
  1589. Message-ID: <9104172239.AA03257@henry>
  1590. In-Reply-To: fjlim@garnet.berkeley.edu's message of 17 Apr 91 09:57:22 GMT <9104170953.AA13412@garnet.berkeley.edu>
  1591. Newsgroups: fa.think-c
  1592. Lines: 7
  1593. Date: 17 Apr 91 23:13:49 GMT
  1594.  
  1595. Allow me to publicly aplogize for publicly speculating on the
  1596. relationship between Greg Dow and John Crunch. I'm full of it, and
  1597. have no business polluting the airwaves with this nonsense. Sigh. I
  1598. wish I had better electronic social skills.
  1599.  
  1600. -g
  1601.  
  1602. 
  1603. 
  1604. Path: ucivax!gateway
  1605. From: dmac@eagle.mit.edu ("David S. McCormick")
  1606. Subject: Please repost reply to TCL history
  1607. Message-ID: <9104181343.AA20707@eagle.mit.edu>
  1608. Newsgroups: fa.think-c
  1609. Lines: 9
  1610. Date: 18 Apr 91 13:45:02 GMT
  1611.  
  1612. My Mac crashed while reading the reply to Greg Dow's TCL history note.
  1613. Would the person who posted please send me a copy of that posting.
  1614. Thanks.
  1615.  
  1616. Cheers,
  1617. David S. McCormick
  1618. MIT-EAPS Geology
  1619. dmac@athena.mit.edu
  1620. dmac@eagle.mit.edu
  1621. 
  1622. 
  1623. Path: ucivax!gateway
  1624. From: jerome@ee.fit.edu (Jerome Chan Yeow Heong - 57875)
  1625. Subject: Think C Class Libraries
  1626. Message-ID: <9104191941.AA26548@ee.fit.edu>
  1627. Newsgroups: fa.think-c
  1628. Lines: 5
  1629. Date: 19 Apr 91 20:57:57 GMT
  1630.  
  1631. I've recently acquired a copy of Think-C but after reading through
  1632. the manuals, I've only had a hazy idea of how to use them. Can someone suggest a book that would be helpful for beginners in OOP, specifically for think-C.
  1633.  
  1634. Thank you!!
  1635.  
  1636. 
  1637. 
  1638. Path: ucivax!gateway
  1639. From: EAO102@psuvm.psu.edu (Ernie Oporto 867-5212)
  1640. Subject: Re: Think C Class Libraries
  1641. Message-ID: <9104200904.aa26775@ics.uci.edu>
  1642. In-Reply-To: jerome AT ee.fit.edu -- 19 Apr 91 20:57:57 GMT
  1643. Newsgroups: fa.think-c
  1644. Lines: 3
  1645. Date: 20 Apr 91 16:04:13 GMT
  1646.  
  1647. The Macintosh Programming Primer: Inside the ToolBox Using Think C (Vol I and I
  1648. I).  They are great help.  I and many others will suggest these to start with.
  1649.                                                         --Ernie
  1650. 
  1651. 
  1652. Path: ucivax!gateway
  1653. From: well!crunch@apple.com (John Draper)
  1654. Subject: Some more useful information
  1655. Message-ID: <9104202147.AA07267@well.sf.ca.us>
  1656. Newsgroups: fa.think-c
  1657. Lines: 55
  1658. Date: 21 Apr 91 00:05:15 GMT
  1659.  
  1660.  
  1661.     I found yet another "Gotcha!!" in TCL that people should
  1662. know about.
  1663.  
  1664.     Because of the high overhead of Pane management,  it is
  1665. often necessary to "re-use" panes when it becomes necessary to
  1666. deal with a lot of them.    In order to do this,  it is possible
  1667. (And highly recommended) that if you have large panoramas,  and
  1668. want to re-use panes that have scrolled off the main viewing
  1669. area.    Not only does lots of panes cause poor performance,
  1670. but it bogs down the Mac memory manager by having lots of
  1671. handles.    Then New becomes agonizingly slow.
  1672.  
  1673.     The panes that are NOT used (IE:  out of view) can be hidden
  1674. via the Hide method.   Then,  when it becomes necessary to view
  1675. them (IE: they are scrolled into view),   information can be loaded
  1676. into them for display.    The mechanism really increases the
  1677. performance,   but causes headaches when printing.
  1678.  
  1679.     For example,  if you call Show() while the "printing" flag is
  1680. set,   this messes up the GrafPort,  because Show() in CPane,
  1681. calls Refresh().    I suggested fox for this should be added to
  1682. CPane,  so if you have no quelms about changing CPane,  then
  1683. the proper code for CPane::Show() should be as follows,   and
  1684. fixes this problem.     This way,  if any code calls Show() while
  1685. printing flag is set,   this won't cause problems.
  1686.  
  1687. Old:
  1688.  
  1689. void    CPane::Show()
  1690. {
  1691.     if (!visible) {
  1692.         inherited::Show();
  1693.         Refresh();
  1694.     }
  1695. }
  1696.  
  1697. New:
  1698.  
  1699. void    CPane::Show()
  1700. {
  1701.     if (!visible) {
  1702.         inherited::Show();
  1703.         if (!printing)
  1704.             Refresh();
  1705.     }
  1706. }
  1707.  
  1708.     Naturally,  you can add this code to a SubClass of a CPane
  1709. and it should work OK.    Just dont ever call Refresh() during
  1710. printing,   and with this fix,  you can now call Show(),  which
  1711. is useful when you want to re-use panes while printing.
  1712.  
  1713. John D.
  1714.  
  1715. 
  1716. 
  1717. Path: ucivax!gateway
  1718. From: well!crunch@apple.com (John Draper)
  1719. Subject: A Better fix
  1720. Message-ID: <9104210758.AA21718@well.sf.ca.us>
  1721. Newsgroups: fa.think-c
  1722. Lines: 72
  1723. Date: 21 Apr 91 09:01:15 GMT
  1724.  
  1725.  
  1726.     I have a cleaner fix for the printing problem.   I discovered
  1727. a LIT of things that it now fixes.    Currently,  in TCL,  it is
  1728. not possible to pass a text handle to CStaticText while the
  1729. print Grafport is "thePort".    In my earlier posting,   I Only
  1730. mentioned that Hide() calls Refresh.    It turns out that TCL
  1731. calls Refresh in other instances while printing.   So,  instead
  1732. of changing Hide NOT to call refresh,   I think it might be better
  1733. to modify Refresh so it doesn't muck up and steal "thePort".
  1734.  
  1735.     The culprit is RefreshRect,  in that during printing,  it calls
  1736. SetPort(macPort) which does the dirty stuff.    So I have modified
  1737. RefreshRect().   It not only fixed ONE printing bug,  but fixed
  1738. ALL of them.    The fix is as follows.....  and is now a current
  1739. fixture in my copy of TCL,  and it shouldn't have any side effects,
  1740. or affect other operations.    The other fix I proposed is also valid,
  1741. but this one should catch ALL problems unless you override and
  1742. do your OWN RefreshRect.    It is also possible to disregard the
  1743. earlier change,  and add this one.
  1744.  
  1745. Old RefreshRect
  1746. ==============
  1747.  
  1748. void    CPane::RefreshRect(
  1749.     Rect        *area)                    /* Area in Frame coordinates        */
  1750. {
  1751.     Rect        aperture;                /* Visible area of Pane                */
  1752.  
  1753.     if (ReallyVisible()) {
  1754.  
  1755.         < Code ommitted to abide by copyright regs >
  1756.         < Just replace it with YOUR copy           >
  1757.  
  1758.     }
  1759. }
  1760.  
  1761. New RefreshRect
  1762. ===============
  1763.  
  1764. void    CPane::RefreshRect(
  1765.     Rect        *area)                    /* Area in Frame coordinates        */
  1766. {
  1767.     Rect        aperture;                /* Visible area of Pane                */
  1768.  
  1769.     if (ReallyVisible() && !printing) {
  1770.  
  1771.         < Code ommitted to abide by copyright regs >
  1772.  
  1773.     }
  1774. }
  1775.  
  1776.  
  1777.     Remember,  this ONLY affects printing,   and it is un-necessary
  1778. to call InvalRect anyway,   because the print code is going to
  1779. be calling DrawAll instead of the Updating mechanism.
  1780.  
  1781.     If you are sure that you will NEVER be calling CPane::Refresh
  1782. while "printing = TRUE",  these changes are necessary.   But please
  1783. note that TCL calls Refresh in a lot of un-expected places.    Best
  1784. way to catch them all,  is to put a breakpoint after the statement
  1785. below in CPrinter::PrintPageRange.
  1786.  
  1787.     macPrintPort = PrOpenDoc(macTPrint, NULL, NULL);
  1788.  
  1789.     Then,  you put a breakpoint at CPane::Refresh(),  and if you
  1790. actually have code that calls Refresh(),  or call other TCL code
  1791. that calls Refresh(),  you will break there.    If this happens,
  1792. then the changes above will be needed if you expect printing to
  1793. work correctly.
  1794.  
  1795. John D.
  1796.  
  1797. 
  1798. 
  1799. Xref: ucivax comp.sys.mac.programmer:22360 fa.think-c:400
  1800. Path: ucivax!orion.oac.uci.edu!nntpsrv
  1801. From: bdugan@teri.bio.uci.edu (Bill Dugan)
  1802. Subject: GetNextEvent beeps at me instead of returning keyDown
  1803. Nntp-Posting-Host: teri.bio.uci.edu
  1804. Message-ID: <28115A68.6279@orion.oac.uci.edu>
  1805. Summary: This has got to be a really stupid problem
  1806. Newsgroups: comp.sys.mac.programmer,fa.think-c
  1807. Organization: University of California, Irvine
  1808. Lines: 21
  1809. Date: 21 Apr 91 09:24:56 GMT
  1810.  
  1811. I'm tearing my hair out over this one.  I'm writing a Think C application 
  1812. that uses the stdio functions.  In my event loop, it returns a mouseDown
  1813. correctly, and I can drag windows, choose menu items, etc.  But when I
  1814. hit a key, it just beeps at me.  GetNextEvent doesn't even take the
  1815. "case keyDown"; it just keeps cycling over and over waiting for an event.
  1816. I'm calling GetNextEvent(everyEvent,&myEvent) the same way I do in every
  1817. other program I've ever written, but this code is a couple of years old
  1818. and converted from a Think C 3.0 project.  The code did work under 3.0.
  1819. (I've since deleted that project and started a new one just in case it was
  1820. a corrupted project file, but no dash, same problem.  I have the same bug,
  1821. incidentally, under both System 6.0.7 and 7.0b4.)
  1822.  
  1823. Is there some kind of call I might inadvertently have made that will mask
  1824. out the keyDown event?  Or perhaps GNE thinks that the stdio window is a
  1825. DA window and attempts to take care of the event itself instead of returning
  1826. it to me?
  1827.  
  1828. Puzzled,
  1829.  
  1830. bill
  1831. (thanks in advance!)
  1832. 
  1833. 
  1834. Path: ucivax!gateway
  1835. From: EAO102@psuvm.psu.edu (Ernie Oporto 867-5212)
  1836. Subject: Re: GetNextEvent beeps at me instead of returning keyDown
  1837. Message-ID: <9104211004.aa13215@ics.uci.edu>
  1838. In-Reply-To: bdugan AT teri.bio.UCI.EDU -- 21 Apr 91 09:24:56 GMT
  1839. Newsgroups: fa.think-c
  1840. Lines: 4
  1841. Date: 21 Apr 91 17:04:28 GMT
  1842.  
  1843. Becareful with the use of that GetNextEvent.  According to Mac Programming Prim
  1844. er, you should be checking to see if WaitNextEvent is implemented on your machi
  1845. ne.
  1846.                                           --Ernie
  1847. 
  1848. 
  1849. Path: ucivax!gateway
  1850. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  1851. Subject: GetNextEvent beeps at me instead of returning keyDown
  1852. Message-ID: <9104220235.AA04718@chaos.cs.brandeis.edu>
  1853. In-Reply-To: Bill Dugan's message of 21 Apr 91 09:24:56 GMT <28115A68.6279@orion.oac.uci.edu>
  1854. Newsgroups: fa.think-c
  1855. Lines: 27
  1856. Date: 22 Apr 91 03:33:03 GMT
  1857.  
  1858.    Is there some kind of call I might inadvertently have made that
  1859.    will mask out the keyDown event?  Or perhaps GNE thinks that the
  1860.    stdio window is a DA window and attempts to take care of the event
  1861.    itself instead of returning it to me?
  1862.  
  1863. Actually, the stdio window (called the "console" window in v4.0) is
  1864. implemented as a self-installing driver, which behaves like a DA.  If
  1865. this window is frontmost, and if you've done the standard mac
  1866. initializations, then you will get beeps for keydowns.  This is
  1867. because the console library only receives input if you haven't done
  1868. the standard mac inits.  The downside to this is that the console
  1869. window grabs the key events if it's frontmost even if it doesn't use
  1870. them.
  1871.  
  1872. The simplest way to fix this problem would be to make sure that the
  1873. console window isn't frontmost when your program receives input.
  1874.  
  1875. The less simple fix is to modify the driver event mask for the console
  1876. window, by looking up the console driver in the Unit Table.  If you're
  1877. interested in the trickier solution, I can post the code. (It's at
  1878. work, or I'd post it now.)
  1879.  
  1880.     -phil
  1881. ----
  1882.    Phil Shapiro                           Technical Support Analyst
  1883.    Language Products Group                     Symantec Corporation
  1884.         Internet: phils@chaos.cs.brandeis.edu
  1885. 
  1886. 
  1887. Path: ucivax!gateway
  1888. From: tj@cs.ucla.edu (Tom Johnson)
  1889. Subject: CommToolBox and TCL
  1890. Message-ID: <9104221544.aa21423@ics.uci.edu>
  1891. Newsgroups: fa.think-c
  1892. Lines: 46
  1893. Date: 22 Apr 91 22:44:42 GMT
  1894.  
  1895.                CommToolBox and TCL
  1896. I have another question regarding the Think Class Library when used with
  1897. routine libraries such as the CommToolBox.  Various CTB tools (terminal
  1898. emulators, etc...) may intstall an additional menu to the menu bar.  When the
  1899. mouse is clicked in the menu bar, the application is supposed to then call
  1900. TMMenu, CMMenu, and FTMenu with the menuID and the itemNumber before doing
  1901. anything else.  TMMenu, CMMenu, and FTMenu return FALSE if they don't handle
  1902. the event.  If none of them handle the event, then it must be an application
  1903. menu.  Simple menu handling code might look like this:
  1904.  
  1905. --------
  1906.  
  1907.   theItem = HiWord(menuResult);
  1908.   theMenu = LoWord(menuResult);
  1909.  
  1910.   if (TMMenu(termHandle, theMenu, theItem))
  1911.        return;
  1912.   if (CMMenu(connHandle, theMenu, theItem))
  1913.        return;
  1914.   if (FTMenu(ftHandle, theMenu, theItem))
  1915.        return;
  1916.  
  1917.  /* it must be an application menu, so we will handle it here */
  1918.    switch (theMenu) {
  1919.         blah bah blah blah;
  1920. }
  1921.  
  1922. --------
  1923.  
  1924. I understand how you can build menus on the fly (ie a FONT menu) and have the
  1925. Bartender call DoCommand with a negative command number, but this only works
  1926. with Menus that have been registered with the Bartender via an AddMenu() call.
  1927. Since the CTB menus are never added to the MenuIndex table, FindCmdNumber (in
  1928. Bartender.c) can't locate the menu by it's ID, and always returns a cmdNull.
  1929. Not what I want, to say the least.
  1930.  
  1931. Is there any way I can get the MenuID so I can call AddMenu() myself?  Any
  1932. suggestions?
  1933. Greg Dow, are you listening? Can you help?
  1934.  
  1935. Thanks--
  1936.  
  1937. Tom
  1938.  
  1939.  
  1940.  
  1941. 
  1942. 
  1943. Path: ucivax!gateway
  1944. From: fjlim@garnet.berkeley.edu
  1945. Subject: TCL and Comm Toolbox menus
  1946. Message-ID: <9104230817.AA26033@garnet.berkeley.edu>
  1947. Newsgroups: fa.think-c
  1948. Lines: 8
  1949. Date: 23 Apr 91 08:17:50 GMT
  1950.  
  1951. Having never used the Comm Toolbox, I don't know what mechanism it uses
  1952. to add its menus to the menu bar. However, you can always override how
  1953. the TCL responds to menu selections. The TCL calls MenuSelect in the
  1954. CDesktop::DispatchClick method. You can change the code (or create a
  1955. subclass of CDesktop) to call the CTB menu routines before it goes through
  1956. the TCL Bartender mechanism.
  1957.  
  1958. -- Greg
  1959. 
  1960. 
  1961. Path: ucivax!gateway
  1962. From: jerome@ee.fit.edu (Jerome Chan Yeow Heong - 57875)
  1963. Subject: Relayed Questions:
  1964. Message-ID: <9104231441.AA13703@ee.fit.edu>
  1965. Newsgroups: fa.think-c
  1966. Lines: 22
  1967. Date: 23 Apr 91 16:18:05 GMT
  1968.  
  1969. Hi again!
  1970.  
  1971. I've got a friend who has some questions to ask but he
  1972. does not have access to a machine so I`m posting this
  1973. for him.
  1974.  
  1975. ----- /Start/ -----
  1976.     How does one copy a pixmap into a picture defination
  1977. so that it is not a series of quickdraw commands?
  1978.     Can you make a picture file from a pixmap and a picture
  1979. defination and how to do it with both ways, including writing
  1980. the color pallet to be used with the picture.
  1981.     How to read a PICT file and set the color table for that
  1982. Picture?
  1983.     How are pictures drawn so fast for games? Do they use
  1984. DrawPicture, or are they offscreen pixmaps which are stamped
  1985. onto the screen pixmap?
  1986. ----- /End/ -----
  1987.  
  1988. I don't know what he's talking about, does anyone else know?
  1989.  
  1990. .Chaos
  1991. 
  1992. 
  1993. Path: ucivax!gateway
  1994. From: spencer@crim.eecs.umich.edu ("Spencer W. Thomas")
  1995. Subject: Relayed Questions:
  1996. Message-ID: <9104231742.AA24467@crim.eecs.umich.edu>
  1997. In-Reply-To: <9104231441.AA13703@ee.fit.edu>
  1998. Newsgroups: fa.think-c
  1999. Lines: 27
  2000. Date: 23 Apr 91 17:45:57 GMT
  2001.  
  2002. I'll give a few of these a go.
  2003.  
  2004.  >     How does one copy a pixmap into a picture defination
  2005.  > so that it is not a series of quickdraw commands?
  2006. You make an offscreen pixmap and draw into it, then BeginPicture and
  2007. CopyBits from the offscreen pixmap.  It still ends up as a single
  2008. QuickDraw "CopyBits" command, but I think this is what he wants.
  2009.  
  2010.  >     How to read a PICT file and set the color table for that
  2011.  > Picture?
  2012. This was recently addressed here or comp.sys.mac.programming, I forget
  2013. which.  I don't remember the exact answer, but I note that a Pixmap in
  2014. a Picture generally has a color table associated with it.
  2015.  
  2016.  >     How are pictures drawn so fast for games? Do they use
  2017.  > DrawPicture, or are they offscreen pixmaps which are stamped
  2018.  > onto the screen pixmap?
  2019. Yes.
  2020.  
  2021. But seriously, ...  Most of the arcade-style games I've looked at the
  2022. internals of ((Beyond) Dark Castle, Continuum, e.g.) use the offscreen
  2023. bit/pixmaps approach.
  2024.  
  2025.  
  2026. =Spencer W. Thomas         EECS Dept, U of Michigan, Ann Arbor, MI 48109
  2027. spencer@eecs.umich.edu        313-936-2616 (8-6 E[SD]T M-F)
  2028.  
  2029. 
  2030. 
  2031. Path: ucivax!gateway
  2032. From: soudan@iitmax.iit.edu (Bassel Soudan)
  2033. Subject: (none)
  2034. Message-ID: <9104231901.AA27459@iitmax.iit.edu>
  2035. Newsgroups: fa.think-c
  2036. Lines: 29
  2037. Date: 23 Apr 91 18:09:20 GMT
  2038.  
  2039.  
  2040. Re : Problems or Bugs with CPane.
  2041.  
  2042.     It seems that everybody is talking about the problems with Refresh()
  2043. in the CPane definition. Well, here is another one.
  2044.  
  2045.     I am designing an interactive program that should allow you to move
  2046. Panes around ( I am using them to simulate fields [ala HyperCard]) The
  2047. problem is that if you move a CPane the Offset method calls Refresh() which
  2048. screws the thePort completely. In my situation, the origin of thePort is
  2049. somehow moved so that when you draw the screen after the moving is done,
  2050. the drawing will start somewhere close to the middle of the screen"!!!
  2051.  
  2052.     I debugged through the code (about three days of work) and finally
  2053. narrowed it down to this. I placed a SetOrigin statement before redrawing
  2054. the screen, and now everything is fine.
  2055.  
  2056.     I am not quite sure how to work this into the fixes that were
  2057. offered here? And can I get some input on what I am doing! Should I use
  2058. CPanes (decendents actually) to simulate HyperCard fields? If you have
  2059. something better please reply ASAP? One last question, How do I simulate
  2060. HyperCard buttons?? The CButton class seems to be directed towards buttons
  2061. that appear in control and dialog boxes.
  2062.  
  2063.     Sincerely yours,
  2064.  
  2065.     Bassel Soudan
  2066.  
  2067.     soudan@iitmax.iit.edu
  2068. 
  2069. 
  2070. Path: ucivax!gateway
  2071. From: bootsie!olson@ics.uci.edu ("Eric K. Olson")
  2072. Subject: Re: Relayed Questions
  2073. Message-ID: <9104232314.AA28750@bootsie.UUCP>
  2074. X-Mailer: Mail User's Shell (6.4 2/14/89)
  2075. Newsgroups: fa.think-c
  2076. Reply-To: olson@endor.harvard.edu
  2077. Lines: 29
  2078. Date: 23 Apr 91 22:16:16 GMT
  2079.  
  2080. In your message of Apr 23,  5:45pm, it is written:
  2081. >
  2082. > I'll give a few of these a go.
  2083. >
  2084. >  >     How to read a PICT file and set the color table for that
  2085. >  > Picture?
  2086. > This was recently addressed here or comp.sys.mac.programming, I forget
  2087. > which.  I don't remember the exact answer, but I note that a Pixmap in
  2088. > a Picture generally has a color table associated with it.
  2089. >
  2090.  
  2091. Executive Summary:  Read the Picture twice.  Set the QDProc for CopyBits
  2092. to your own routine (and all the others to a null routine, for speed)
  2093. the first time through.  Extract the PixMap Color Table from the source
  2094. (destination?) bitmap argument of your CopyBits routine (the BitMap can
  2095. actually be a PixMap-- you must do the cannonical test).  Save that,
  2096. reset the QDProcs, and read the Picture normally.
  2097.  
  2098. > =Spencer W. Thomas         EECS Dept, U of Michigan, Ann Arbor, MI 48109
  2099. > spencer@eecs.umich.edu        313-936-2616 (8-6 E[SD]T M-F)
  2100. >
  2101. >
  2102.  
  2103.  
  2104. --
  2105. Eric K. Olson, Editor, Prepare()      NOTE:     olson@bootsie.uucp doesn't work
  2106. Lexington Software Design             Internet: olson@endor.harvard.edu
  2107. 72A Lowell St., Lexington, MA  02173  Uucp:     harvard!endor!olson
  2108. (617) 863-9624                        Bitnet:   OLSON@HARVARD
  2109. 
  2110. 
  2111. Path: ucivax!gateway
  2112. From: watanabe@cs.uiuc.edu (Larry Watanabe)
  2113. Subject: 32-bit Panoramas
  2114. Message-ID: <9104232216.AA21187@herodotus.cs.uiuc.edu>
  2115. Newsgroups: fa.think-c
  2116. Lines: 9
  2117. Date: 23 Apr 91 22:16:57 GMT
  2118.  
  2119.  
  2120. Last week someone posted some complaints about
  2121. the inability of CPanorama to handle panoramas with
  2122. visual extents larger than can be handled with 16-bit
  2123. coordinate system. I have lost his address and would
  2124. appreciate if someone would send it to me. I think
  2125. the e-mail address had the word "crunch" in it.
  2126.  
  2127. -Larry Watanabe watanabe@cs.uiuc.edu
  2128. 
  2129. 
  2130. Path: ucivax!gateway
  2131. From: schorsch@oxy.edu (Brent Schorsch)
  2132. Subject: Re: Relayed Questions:
  2133. Message-ID: <9104241842.AB03746@gate.oxy.edu>
  2134. Newsgroups: fa.think-c
  2135. Lines: 23
  2136. Date: 24 Apr 91 18:42:42 GMT
  2137.  
  2138. Spencer W. Thomas (spencer@eecs.umich.edu) says:
  2139. >
  2140. > >     How does one copy a pixmap into a picture defination
  2141. > > so that it is not a series of quickdraw commands?
  2142. >You make an offscreen pixmap and draw into it, then BeginPicture and
  2143. >CopyBits from the offscreen pixmap.  It still ends up as a single
  2144. >QuickDraw "CopyBits" command, but I think this is what he wants.
  2145. >
  2146.  
  2147. I have a question about this, the CopyBits is from the offscreen pixmap,
  2148. where is it to? Does it matter? does the clip region or visregion of the
  2149. destination have any significance? any other problems that mioght occur?
  2150. what if I want to do this but don't want anything visible, just copybits to
  2151. another offscreen bitmap?
  2152.  
  2153. -Thanks!
  2154. Brent
  2155.  
  2156.  
  2157.                               !  "He was strangely relieved about
  2158. Brent Schorsch                !   getting rid of his old fridge and
  2159. schorsch@oxy.edu              !   looked forward to enjoying a new phase
  2160.                               !   of fridge ownership" -Douglas Adams
  2161. 
  2162. 
  2163. Path: ucivax!gateway
  2164. From: autodesk!mehitabel!booter@fernwood.mpk.ca.us ("E. Richards")
  2165. Subject: Please remove Gary Lang from your list
  2166. Message-ID: <9104241804.AA23011@mehitabel.YP.acad>
  2167. Newsgroups: fa.think-c
  2168. Lines: 31
  2169. Date: 24 Apr 91 19:12:21 GMT
  2170.  
  2171.  
  2172. He has left the company.
  2173.  
  2174.     From MAILER-DAEMON@autodesk  Tue Apr 23 16:08:07 1991
  2175.     Return-Path: <MAILER-DAEMON@autodesk>
  2176.     Date: Tue, 23 Apr 91 16:11:20 PDT
  2177.     From: autodesk!MAILER-DAEMON (Mail Delivery Subsystem)
  2178.     Subject: Returned mail: Host unknown
  2179.     Message-Id: <9104232311.AA14371@autodesk.uucp >
  2180.     To: Postmaster@autodesk
  2181.     Status: R
  2182.  
  2183.        ----- Transcript of session follows -----
  2184.     bad system name: henry
  2185.     uux failed. code 68
  2186.     550 henry!glang@autodesk.com... Host unknown
  2187.  
  2188.       ----- Message header follows -----
  2189.     Return-Path: <fa.think-c-outbound-request@ics.uci.edu>
  2190.     Received: from ics.uci.edu by autodesk.uucp  (4.1/SMI-3.2)
  2191.         id AA14360; Tue, 23 Apr 91 16:11:20 PDT
  2192.     Received: by fernwood.mpk.ca.us; id AA03374; Tue, 23 Apr 91 15:41:48 -0700
  2193.     Received: from ics.uci.edu by ics.uci.edu id aa27959; 23 Apr 91 15:19 PDT
  2194.     Received: from USENET by ics.uci.edu id aa27920; 23 Apr 91 15:18 PDT
  2195.     From: Larry Watanabe <watanabe@cs.uiuc.edu>
  2196.     Subject: 32-bit Panoramas
  2197.     Message-Id: <9104232216.AA21187@herodotus.cs.uiuc.edu>
  2198.     Newsgroups: fa.think-c
  2199.     Date: 23 Apr 91 22:16:57 GMT
  2200.     To: think-c@ics.uci.edu
  2201.  
  2202. 
  2203. 
  2204. Path: ucivax!gateway
  2205. From: nagel@ics.uci.edu (Mark Nagel)
  2206. Subject: ARCHIVE: Protoclip 1.2
  2207. Message-ID: <19256.672620543@ics.uci.edu>
  2208. Newsgroups: fa.think-c
  2209. Reply-To: nagel@ics.uci.edu
  2210. Organization: University of California, Irvine - Dept of ICS
  2211. Lines: 33
  2212. Date: 25 Apr 91 23:02:36 GMT
  2213. Phone: (714) 856-5039
  2214.  
  2215.     [Administrative note: Last time I posted an ARCHIVE notice, many ]
  2216.     [people asked me to send them the package.  As stated in the     ]
  2217.     [list description blurb, you can retrieve files via anonymous ftp]
  2218.     [or via mail using the archive-server address.  I will not send  ]
  2219.     [any individual anything unless there has been a failed effort at]
  2220.     [retrieving files the supported way.  -Mark                      ]
  2221.  
  2222. From: Alex Chaffee <chaffee@reed.reed.EDU>
  2223. Subject: Protoclip 1.2 (w/ source)
  2224. Date: Thu, 25 Apr 91 12:40:14 PDT
  2225.  
  2226. [Here's a submission for the archives.]
  2227.  
  2228. This FKEY takes any C source code in the clipboard and converts it into a
  2229. list of ANSI prototypes, ready for pasting. The prototyping code is based on
  2230. a Unix program called mkptypes by Eric R. Smith (ersmith@uwovax.uwo.ca or
  2231. @uwovax.bitnet). Since it's in the public domain, protoclip is freeware.
  2232.  
  2233. It works with Think C methods and some C++ constructs (not operator
  2234. overloads, for example).
  2235.  
  2236. Full Think C source is included - including a module for treating a Handle
  2237. like a FILE * (sort of).
  2238.  
  2239.  - Alex
  2240.  
  2241. --
  2242. Alex Chaffee
  2243. chaffee@reed.bitnet
  2244. Reed College, Portland OR 97202
  2245. ____________________
  2246.  
  2247. [saved as: /mac/think-c/compiler/protoclip-12.hqx; 50K]
  2248. 
  2249. 
  2250. Path: ucivax!gateway
  2251. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  2252. Subject: 32 Bit QuickDraw header file for Think C
  2253. Message-ID: <9104262157.AA06465@chaos.cs.brandeis.edu>
  2254. Newsgroups: fa.think-c
  2255. Lines: 151
  2256. Date: 26 Apr 91 21:57:43 GMT
  2257.  
  2258. This file may already be in the think-c archives, but I couldn't find
  2259. it when I looked around.  This is the official Symantec interface file
  2260. for using Apple's 32 Bit QuickDraw with Think C v4.0.  You will need
  2261. the 32 Bit QuickDraw INIT or a machine that has 32 Bit QuickDraw in
  2262. ROM (or, I guess, System 7) to use these calls.
  2263.  
  2264. This version fixes the bug that many other copies of this header had,
  2265. including the one that's in Dave Mark's "Macintosh C Programing
  2266. Primer", volume 2.  This bug involves the bit shifts in the GWordFlags
  2267. enum that are larger than 16 bits.
  2268.  
  2269. For those of you that are working with System 7, this file is
  2270. superseeded by QDOffscreen.h.
  2271.  
  2272.     -phil
  2273. ----
  2274.    Phil Shapiro                           Technical Support Analyst
  2275.    Language Products Group                     Symantec Corporation
  2276.         Internet: phils@chaos.cs.brandeis.edu
  2277.  
  2278. ---------------- QuickDraw32Bit.h ----------------
  2279. /************************************************************
  2280.  
  2281.  *  Copyright (c) 1989 Symantec Corporation.  All rights reserved.
  2282.  *
  2283.  *  These interfaces are based on material copyrighted
  2284.  *  by Apple Computer, Inc., 1985-1989.
  2285.  *
  2286.  
  2287. ************************************************************/
  2288.  
  2289.  
  2290. #ifndef _QuickDraw32Bit_
  2291. #define _QuickDraw32Bit_
  2292.  
  2293. #ifndef _Color_
  2294. #include <Color.h>
  2295. #endif
  2296.  
  2297. /* New Constants for 32-Bit QuickDraw */
  2298.  
  2299. #define ditherCopy 64            /* Dither mode for Copybits */
  2300. #define RGBDirect 16            /* 16 & 32 bits/pixel pixelType value */
  2301.  
  2302.  
  2303. /* New error codes */
  2304.  
  2305. #define rgnOverflowErr -147        /* Region accumulation failed. Resulting region may be currupt */
  2306. #define pixmapTooDeepErr -148    /* Pixmap is not 1-bit/pixel for BitmapToRegion */
  2307. #define insufficientStackErr -149 /* QuickDraw could not complete the operation */
  2308. #define cDepthErr -157            /* invalid pixel depth passed to NewGWorld or UpdateGWorld */
  2309.  
  2310.  
  2311. /* Flag bits passed to or returned by Offscreen routines */
  2312.  
  2313. enum  {
  2314.     pixPurgeBit = 0,
  2315.     nowNewDeviceBit = 1,
  2316.     pixelsPurgeableBit = 6,
  2317.     pixelsLockedBit = 7,
  2318.  
  2319.     mapPixBit = 16,            /* set if color table mapping occurred */
  2320.     newDepthBit = 17,            /* set if pixels were scaled to a different depth */
  2321.     alignPixBit = 18,            /* set if pixels were realigned to screen alignment */
  2322.      newRowBytesBit = 19,        /* set if pixmap was reconfigured in a new rowBytes */
  2323.     reallocPixBit = 20,        /* set if offscreen buffer had to be reallocated */
  2324.     clipPixBit = 28,            /* set if pixels were or are to be clipped */
  2325.     stretchPixBit = 29,        /* set if pixels were or are to be stretched/shrinked */
  2326.     ditherPixBit = 30,
  2327.     gwFlagErrBit = 31
  2328. };
  2329.  
  2330. #define    pixPurge        (1L << pixPurgeBit)
  2331. #define    nowNewDevice    (1L << nowNewDeviceBit)
  2332. #define    pixelsPurgeable    (1L << pixelsPurgeableBit)
  2333. #define    pixelsLocked    (1L << pixelsLockedBit)
  2334. #define    mapPix            (1L << mapPixBit)
  2335. #define    newDepth        (1L << newDepthBit)
  2336. #define    alignPix        (1L << alignPixBit)
  2337. #define    newRowBytes        (1L << newRowBytesBit)
  2338. #define    reallocPix        (1L << reallocPixBit)
  2339. #define    clipPix            (1L << clipPixBit)
  2340. #define    stretchPix        (1L << stretchPixBit)
  2341. #define    ditherPix        (1L << ditherPixBit)
  2342. #define    gwFlagErr        (1L << gwFlagErrBit)
  2343.  
  2344. typedef long GWorldFlag;
  2345.  
  2346. typedef long GWorldFlags;
  2347.  
  2348. /* Type definition of a GWorldPtr */
  2349.  
  2350. typedef CGrafPtr GWorldPtr;
  2351.  
  2352.  
  2353. pascal OSErr BitmapToRegion(RgnHandle region, BitMap *bMap)
  2354.     = {0xA8D7};
  2355.  
  2356.  
  2357. pascal QDErr NewGWorld (GWorldPtr *offscreenGWorld, short pixelDepth,
  2358.         Rect *boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags)
  2359.     = {0x7000,0xAB1D};
  2360. pascal Boolean LockPixels (PixMapHandle pm)
  2361.     = {0x7001,0xAB1D};
  2362. pascal void UnLockPixels (PixMapHandle pm)
  2363.     = {0x7002,0xAB1D};
  2364. pascal GWorldFlags UpdateGWorld (GWorldPtr *offscreenGWorld, short pixelDepth,
  2365.         Rect *boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags)
  2366.     = {0x7003,0xAB1D};
  2367. pascal void DisposeGWorld (GWorldPtr offscreenGWorld)
  2368.     = {0x7004,0xAB1D};
  2369. pascal void GetGWorld (CGrafPtr *port, GDHandle *gdh)
  2370.     = {0x7005,0xAB1D};
  2371. pascal void SetGWorld (CGrafPtr port, GDHandle gdh)
  2372.     = {0x7006,0xAB1D};
  2373. pascal void CTabChanged (CTabHandle ctab)
  2374.     = {0x7007,0xAB1D};
  2375. pascal void PixPatChanged (PixPatHandle ppat)
  2376.     = {0x7008,0xAB1D};
  2377. pascal void PortChanged (GrafPtr port)
  2378.     = {0x7009,0xAB1D};
  2379. pascal void GDeviceChanged (GDHandle gdh)
  2380.     = {0x700A,0xAB1D};
  2381. pascal void AllowPurgePixels (PixMapHandle pm)
  2382.     = {0x700B,0xAB1D};
  2383. pascal void NoPurgePixels (PixMapHandle pm)
  2384.     = {0x700C,0xAB1D};
  2385. pascal GWorldFlags GetPixelsState (PixMapHandle pm)
  2386.     = {0x700D,0xAB1D};
  2387. pascal void SetPixelsState (PixMapHandle pm, GWorldFlags state)
  2388.     = {0x700E,0xAB1D};
  2389. pascal Ptr GetPixBaseAddr (PixMapHandle pm)
  2390.     = {0x700F,0xAB1D};
  2391. pascal QDErr NewScreenBuffer (Rect *globalRect, Boolean purgeable, GDHandle *gdh,
  2392.         PixMapHandle *offscreenPixMap)
  2393.     = {0x7010,0xAB1D};
  2394. pascal void DisposeScreenBuffer (PixMapHandle offscreenPixMap)
  2395.     = {0x7011,0xAB1D};
  2396. pascal GDHandle GetGWorldDevice (GWorldPtr offscreenGWorld)
  2397.     = {0x7012,0xAB1D};
  2398.  
  2399. /* New Palette Manger routines, from the <Palettes.h> MPW file. */
  2400.  
  2401. pascal long Entry2Index(short srcEntry)
  2402.     = {0x7000,0xAAA2};
  2403. pascal void RestoreDeviceClut(GDHandle gdh)
  2404.     = {0x7002,0xAAA2};
  2405. pascal void ResizePalette(PaletteHandle srcPalette, short dstSize)
  2406.     = {0x7003,0xAAA2};
  2407.  
  2408. #endif
  2409. 
  2410. 
  2411. Path: ucivax!gateway
  2412. From: GFT_ROBERT@gsbvxb.uchicago.edu (opcode ranger)
  2413. Subject: Where are the THINK archives?
  2414. Message-ID: <910426185517.202012c6@GSBACD.UCHICAGO.EDU>
  2415. Newsgroups: fa.think-c
  2416. Lines: 9
  2417. Date: 26 Apr 91 23:56:02 GMT
  2418. X-Vmsmail-To: @THINKC
  2419.  
  2420. I guess the subject says it all.  Can anyone clue me in?
  2421.  
  2422. RobertI
  2423.  
  2424. ============================================================================
  2425. = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "Good tea.        =
  2426. =                             * all my opinions are *  Nice house."     =
  2427. =                                * mine                *  -Worf            =
  2428. ============================================================================
  2429. 
  2430. 
  2431. Path: ucivax!gateway
  2432. From: Chris_McNeil@macsmtp.csd.unb.ca (Chris McNeil)
  2433. Subject: Cdev problems
  2434. Message-ID: <9104291217.aa21794@ics.uci.edu>
  2435. X-Mailer: QuickMail/SMTP interface.
  2436. Newsgroups: fa.think-c
  2437. Lines: 54
  2438. Date: 29 Apr 91 19:17:44 GMT
  2439.  
  2440. I have a Cdev (based on sample cdev that comes with think C) that trys to put
  2441. up a window with a message in it when itemhit = 12. This works a few times and
  2442. then my Mac freezes up. Also when this code is included if I switch the control
  2443. panel to the backgroud and then back again the Mac crashes when I close the
  2444. control panel. The code is as follows: ( I've cut out most of the code that
  2445. isn't causing me any problems.
  2446.  
  2447. Any suggestions, solutions etc would be most welcome.
  2448.  
  2449. Chris McNeil
  2450. cjm@unb.ca
  2451.  
  2452. void putupdialog()
  2453.  
  2454.  
  2455.  
  2456. {
  2457. extern int alertact;
  2458. CharsHandle editrec;
  2459.     DialogPtr MyWindow;
  2460.     GrafPtr savePort;
  2461.     /*Boolean MyFilter();*/
  2462.     EventRecord myEvent;
  2463.     Rect windowbounds;
  2464.     int item;
  2465.  
  2466.     savePort=thePort;
  2467.  
  2468.  
  2469.         /* Calculate the size of the window  */
  2470.  
  2471.         windowbounds.top=30;
  2472.         windowbounds.left=8;
  2473.         windowbounds.right=508;
  2474.         windowbounds.bottom=(((48* 4)+windowbounds.top));
  2475.  
  2476.         MyWindow=NewDialog(0L,&windowbounds,"",1,2,-1L,1,1,0L);
  2477.  
  2478.         /* Write the message to the window    */
  2479.  
  2480.          SetPort(MyWindow);
  2481.  
  2482.     /* Restore the Graf Port */
  2483.     SetPort(savePort);
  2484.  
  2485.     ModalDialog(0L,item);
  2486.     DisposDialog(MyWindow);
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492. }
  2493.  
  2494. 
  2495. 
  2496. Path: ucivax!gateway
  2497. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  2498. Subject: Cdev problems
  2499. Message-ID: <9104292213.AA00121@chaos.cs.brandeis.edu>
  2500. In-Reply-To: Chris McNeil's message of 29 Apr 91 19:17:44 GMT <9104291217.aa21794@ics.uci.edu>
  2501. Newsgroups: fa.think-c
  2502. Lines: 26
  2503. Date: 29 Apr 91 22:14:08 GMT
  2504.  
  2505. Chris McNeil <Chris_McNeil@macsmtp.csd.unb.ca> writes:
  2506.    I have a Cdev (based on sample cdev that comes with think C) that
  2507.    trys to put up a window with a message in it when itemhit = 12.
  2508.    This works a few times and then my Mac freezes up. Also when this
  2509.    code is included if I switch the control panel to the backgroud and
  2510.    then back again the Mac crashes when I close the control panel.
  2511.  
  2512.    [ ... stuff deleted ... ]
  2513.  
  2514.        int item;
  2515.  
  2516.        ModalDialog(0L,item);
  2517.  
  2518. This is most likely the cause of some of your problems.  You should
  2519. pass the address of item to ModalDialog, since it expects itemHit to
  2520. be a VAR parameter.
  2521.  
  2522. Like:  ModalDialog(0L, &item);
  2523.  
  2524. I have no idea why it crashes when you close the control panel.
  2525.  
  2526.     -phil
  2527. ----
  2528.    Phil Shapiro                           Technical Support Analyst
  2529.    Language Products Group                     Symantec Corporation
  2530.         Internet: phils@chaos.cs.brandeis.edu
  2531. 
  2532. 
  2533. Path: ucivax!gateway
  2534. From: mead@informatics.wustl.edu (Charles Mead)
  2535. Subject: strangeness with 'open'
  2536. Message-ID: <9104300331.AA11632@informatics.WUstl.EDU>
  2537. Newsgroups: fa.think-c
  2538. Lines: 9
  2539. Date: 30 Apr 91 03:31:58 GMT
  2540.  
  2541. I'm writing a file manager package and am using lseek, read, write, open, etc.
  2542. I have found that if I open a file without using the O_TEXT option that I
  2543. can't write text into it (which is probably the behavrior you would expect).
  2544. However, 'write' still says it's writing text in, i.e. it returns nonzero
  2545. byte values when called.  When you try to read from the file however, there's
  2546. nothing there.  I have asked a couple of UNIX C people and they seem to think
  2547. this is aberrant behavior found only on the Mac.  Any comments, criticims, etc.
  2548. Thanks.
  2549. Charles Mead (mead@informactics.wustl.edu)
  2550. 
  2551. 
  2552. Path: ucivax!gateway
  2553. From: ehorvath@attmail.com
  2554. Subject: Re: strangeness with 'open'
  2555. Original-From: attmail!ehorvath (Ned Horvath )
  2556. Lines: 58
  2557. Date: 30 Apr 91 06:01:03 GMT
  2558. Phone: +1 908 671 7100
  2559. Message-ID: <9104292300.aa03288@ics.uci.edu>
  2560. In-Reply-To: your message <internet1200349580> of Tue Apr 30 03:31:58 GMT 1991
  2561. >To: internet!ics.uci.edu!think-c
  2562. Content-Type: text
  2563. Content-Length: 2165
  2564. Newsgroups: fa.think-c
  2565. Message-Version: 2
  2566. EMail-Version: 2
  2567. UA-Message-ID: <MAC-1.3.4A1-618034-ehorvath-390>
  2568. UA-Content-ID: <MAC-1.3.4A1-618034-ehorvath-390>
  2569. MTS-Message-ID: <ehorvath1200558540>
  2570.  
  2571. >I'm writing a file manager package and am using lseek, read, write, open,
  2572. >etc. I have found that if I open a file without using the O_TEXT option that
  2573. >I can't write text into it (which is probably the behavrior you would
  2574. >expect). However, 'write' still says it's writing text in, i.e. it returns
  2575. >nonzero
  2576. >byte values when called.  When you try to read from the file however, there's
  2577. >nothing there.  I have asked a couple of UNIX C people and they seem to think
  2578. >this is aberrant behavior found only on the Mac.  Any comments, criticims,
  2579. >etc.
  2580. >Thanks.
  2581. >Charles Mead (mead@informactics.wustl.edu)
  2582.  
  2583. You don't provide a lot of detail on the nature of your failure.  However, the
  2584. following program executed flawlessly for me (link with ANSI and unix libs):
  2585. ----- cut here -----
  2586. #include <unix.h>
  2587. #include <string.h>
  2588. #include <fcntl.h>
  2589. #include <errno.h>
  2590. #include <stdlib.h>
  2591.  
  2592. char text[] = "This is the output of the program.\r";
  2593. main ()
  2594. {
  2595.     int fildes;
  2596.  
  2597.     fildes = open ("thud", O_CREAT|O_WRONLY|O_TRUNC);
  2598.     if (fildes < 0) {
  2599.         fprintf (stderr, "open failed, errno = %d\n", errno);
  2600.         exit (EXIT_FAILURE);
  2601.     } else {
  2602.         write (fildes, text, strlen (text));
  2603.         close (fildes);
  2604.         exit (EXIT_SUCCESS);
  2605.     }
  2606. }
  2607. ----- cut here -----
  2608.  
  2609. There is, however, a subtlety about end-of-line characters: notice that the
  2610. printf line (which doesn't execute, by the way) uses \n, whereas the output
  2611. text uses \r.  If I'd used O_TEXT I could use \r or \n: O_TEXT will cause the
  2612. I/O library to patch up end-of-line sequences for you on the Mac, since every
  2613. other Mac app expects \r to end TEXT-file lines.  If you write \n's to a file
  2614. not opened with O_TEXT, then try to read them in keying off \r, you may not
  2615. get the results you expect.
  2616.  
  2617. Also note that if "thud" doesn't exist, it gets created with both a creator
  2618. and a type of '????', where maybe you would've preferred TEXT.  If that's your
  2619. preference, use O_TEXT.  However, this program gives the content of the data
  2620. fork precisely the content of the text string.
  2621.  
  2622. I didn't experiment with other combinations of open() flags.  Feel free to
  2623. play with this snippet any way you see fit.
  2624.  
  2625. Hope that helps.
  2626.  
  2627. =Ned Horvath=
  2628. ehorvath@attmail.com
  2629. 
  2630.